Update app.py
Browse files
app.py
CHANGED
|
@@ -52,6 +52,9 @@ def chat(history, system_message, max_tokens, temperature, top_p, top_k, repetit
|
|
| 52 |
tokens = re.findall(r'(.*?)(\s|$)', tokens)
|
| 53 |
for subtoken in tokens:
|
| 54 |
subtoken = "".join(subtoken)
|
|
|
|
|
|
|
|
|
|
| 55 |
answer = subtoken
|
| 56 |
history[-1][1] += answer
|
| 57 |
# stream the response
|
|
|
|
| 52 |
tokens = re.findall(r'(.*?)(\s|$)', tokens)
|
| 53 |
for subtoken in tokens:
|
| 54 |
subtoken = "".join(subtoken)
|
| 55 |
+
# Remove "Response\n" if it's at the beginning of the assistant's output
|
| 56 |
+
if subtoken.startswith("Response\n"):
|
| 57 |
+
subtoken = subtoken[len("Response\n"):]
|
| 58 |
answer = subtoken
|
| 59 |
history[-1][1] += answer
|
| 60 |
# stream the response
|