Spaces:
Sleeping
Sleeping
Tuchuanhuhuhu
commited on
Commit
·
59f29ef
1
Parent(s):
30f89d6
修复换行问题
Browse files- ChuanhuChatbot.py +3 -3
ChuanhuChatbot.py
CHANGED
@@ -173,8 +173,8 @@ def predict(inputs, top_p, temperature, openai_api_key, chatbot=[], history=[],
|
|
173 |
if token_counter == 0:
|
174 |
history.append(" " + partial_words)
|
175 |
else:
|
176 |
-
history[-1] =
|
177 |
-
chatbot[-1] = (history[-2], history[-1])
|
178 |
token_counter += 1
|
179 |
yield chatbot, history, status_text
|
180 |
else:
|
@@ -182,7 +182,7 @@ def predict(inputs, top_p, temperature, openai_api_key, chatbot=[], history=[],
|
|
182 |
responsejson = json.loads(response.text)
|
183 |
content = responsejson["choices"][0]["message"]["content"]
|
184 |
history.append(content)
|
185 |
-
chatbot.append((history[-2],
|
186 |
status_text = "精简完成"
|
187 |
except:
|
188 |
chatbot.append((history[-1], "☹️发生了错误,请检查网络连接或者稍后再试。"))
|
|
|
173 |
if token_counter == 0:
|
174 |
history.append(" " + partial_words)
|
175 |
else:
|
176 |
+
history[-1] = partial_words
|
177 |
+
chatbot[-1] = (history[-2], parse_text(history[-1]))
|
178 |
token_counter += 1
|
179 |
yield chatbot, history, status_text
|
180 |
else:
|
|
|
182 |
responsejson = json.loads(response.text)
|
183 |
content = responsejson["choices"][0]["message"]["content"]
|
184 |
history.append(content)
|
185 |
+
chatbot.append((history[-2], parse_text(content)))
|
186 |
status_text = "精简完成"
|
187 |
except:
|
188 |
chatbot.append((history[-1], "☹️发生了错误,请检查网络连接或者稍后再试。"))
|