Commit 79e48998 by 周峻哲

解决出现预设场景,历史不展示的情况2

parent 1260e759
...@@ -157,7 +157,7 @@ class QA: ...@@ -157,7 +157,7 @@ class QA:
history.append((_question, self.cur_answer)) history.append((_question, self.cur_answer))
async for token in callback.aiter(): async for token in callback.aiter():
self.cur_answer += token self.cur_answer += token
if self.contains_blocked_keywords(self.cur_answer): if self.contains_blocked_keywords(_question):
self.cur_answer = SAFE_RESPONSE self.cur_answer = SAFE_RESPONSE
history[-1] = (_question, self.cur_answer) history[-1] = (_question, self.cur_answer)
yield history yield history
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment