Spaces:
Runtime error
Runtime error
vincentmin
commited on
Commit
•
a9f61c0
1
Parent(s):
ab4a14e
Update app.py
Browse files
app.py
CHANGED
@@ -127,29 +127,10 @@ def chat():
|
|
127 |
temperature=temperature,
|
128 |
top_p=top_p,
|
129 |
)
|
|
|
130 |
chat_history = chat_history + [[message, model_output]]
|
131 |
yield chat_history
|
132 |
return
|
133 |
-
# acc_text = ""
|
134 |
-
# for idx, response in enumerate(stream):
|
135 |
-
# text_token = response.token.text
|
136 |
-
|
137 |
-
# if response.details:
|
138 |
-
# return
|
139 |
-
|
140 |
-
# if text_token in STOP_SUSPECT_LIST:
|
141 |
-
# acc_text += text_token
|
142 |
-
# continue
|
143 |
-
|
144 |
-
# if idx == 0 and text_token.startswith(" "):
|
145 |
-
# text_token = text_token[1:]
|
146 |
-
|
147 |
-
# acc_text += text_token
|
148 |
-
# last_turn = list(chat_history.pop(-1))
|
149 |
-
# last_turn[-1] += acc_text
|
150 |
-
# chat_history = chat_history + [last_turn]
|
151 |
-
# yield chat_history
|
152 |
-
# acc_text = ""
|
153 |
|
154 |
def delete_last_turn(chat_history):
|
155 |
if chat_history:
|
|
|
127 |
temperature=temperature,
|
128 |
top_p=top_p,
|
129 |
)
|
130 |
+
model_output = model_output[len(prompt):].split(f"\n{USER_NAME}")[0]
|
131 |
chat_history = chat_history + [[message, model_output]]
|
132 |
yield chat_history
|
133 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
def delete_last_turn(chat_history):
|
136 |
if chat_history:
|