Fix end on "User:"
Browse files
app.py
CHANGED
@@ -92,8 +92,8 @@ def chat_with_model(messages):
|
|
92 |
streamer.end_of_generation.set() # signal to stop generation thread
|
93 |
break
|
94 |
|
95 |
-
if
|
96 |
-
|
97 |
|
98 |
if "<think>" in token_str:
|
99 |
in_think = True
|
@@ -107,6 +107,9 @@ def chat_with_model(messages):
|
|
107 |
else:
|
108 |
output_text += token_str
|
109 |
|
|
|
|
|
|
|
110 |
messages[-1]["content"] = output_text
|
111 |
yield messages
|
112 |
|
|
|
92 |
streamer.end_of_generation.set() # signal to stop generation thread
|
93 |
break
|
94 |
|
95 |
+
if is_special:
|
96 |
+
continue
|
97 |
|
98 |
if "<think>" in token_str:
|
99 |
in_think = True
|
|
|
107 |
else:
|
108 |
output_text += token_str
|
109 |
|
110 |
+
if "\nUser:" in output_text:
|
111 |
+
output_text = output_text.split("\nUser:")[0].rstrip()
|
112 |
+
|
113 |
messages[-1]["content"] = output_text
|
114 |
yield messages
|
115 |
|