diff --git a/expose.cpp b/expose.cpp index 0d42e2a57..526538ce5 100644 --- a/expose.cpp +++ b/expose.cpp @@ -362,14 +362,14 @@ extern "C" } static std::string detokenized_str = ""; //just share a static object for detokenizing - const char * detokenize(const token_count_outputs input) + const char * detokenize(const detokenize_inputs input) { std::vector input_arr; for(int i=0;i 0 and tokidslen < 65536: - inputs = token_count_outputs() + inputs = detokenize_inputs() inputs.count = tokidslen + inputs.special = addspecial inputs.ids = (ctypes.c_int * tokidslen)() for i, cid in enumerate(tokids): inputs.ids[i] = cid @@ -4235,7 +4241,7 @@ ws ::= | " " | "\n" [ \t]{0,20} assistant_message_start = adapter_obj.get("assistant_start", "\n\n### Response:\n") assistant_message_gen = adapter_obj.get("assistant_gen", assistant_message_start) try: - detokstr = detokenize_ids(tokids) + detokstr = detokenize_ids(tokids,True) except Exception as e: utfprint("Ollama Context Error: " + str(e)) ollamasysprompt = genparams.get('system', "") @@ -6026,7 +6032,8 @@ Change Mode
try: genparams = json.loads(body) tokids = genparams.get('ids', []) - detokstr = detokenize_ids(tokids) + addspecial = genparams.get('special', True) + detokstr = detokenize_ids(tokids,addspecial) response_body = (json.dumps({"result": detokstr,"success":True}).encode()) except Exception as e: utfprint("Detokenize Error: " + str(e))