Update tabbed.py
Browse files
tabbed.py
CHANGED
@@ -35,6 +35,9 @@ def chat(history, system_message, max_tokens, temperature, top_p, top_k, repeat_
|
|
35 |
"\n".join(["\n".join(["USER: "+item[0], "ASSISTANT: "+item[1]])
|
36 |
for item in history])
|
37 |
|
|
|
|
|
|
|
38 |
history[-1][1] = ""
|
39 |
for output in llm(
|
40 |
messages,
|
@@ -48,8 +51,6 @@ def chat(history, system_message, max_tokens, temperature, top_p, top_k, repeat_
|
|
48 |
**config['chat']
|
49 |
):
|
50 |
answer = output['choices'][0]['text']
|
51 |
-
if len(output['choices']) > 1 and answer == '\u200b':
|
52 |
-
answer = output['choices'][1]['text']
|
53 |
print(output['choices'])
|
54 |
history[-1][1] += answer
|
55 |
# stream the response
|
|
|
35 |
"\n".join(["\n".join(["USER: "+item[0], "ASSISTANT: "+item[1]])
|
36 |
for item in history])
|
37 |
|
38 |
+
# remove last space from assistant
|
39 |
+
messages = messages[:-1]
|
40 |
+
|
41 |
history[-1][1] = ""
|
42 |
for output in llm(
|
43 |
messages,
|
|
|
51 |
**config['chat']
|
52 |
):
|
53 |
answer = output['choices'][0]['text']
|
|
|
|
|
54 |
print(output['choices'])
|
55 |
history[-1][1] += answer
|
56 |
# stream the response
|