Commit 1260e759 by 周峻哲

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

parent 65d090a2
...@@ -92,7 +92,7 @@ class QA: ...@@ -92,7 +92,7 @@ class QA:
# if self.contains_blocked_keywords(_question): # if self.contains_blocked_keywords(_question):
# self.cur_answer = SAFE_RESPONSE # self.cur_answer = SAFE_RESPONSE
# yield [(self.cur_oquestion, self.cur_answer)] # yield [(self.cur_oquestion, self.cur_answer)]
# return # return
self.cur_similarity = self.get_similarity(_aquestion=self.cur_oquestion) self.cur_similarity = self.get_similarity(_aquestion=self.cur_oquestion)
self.cur_question = self.prompt.format(context=self.cur_similarity, question=self.cur_oquestion) self.cur_question = self.prompt.format(context=self.cur_similarity, question=self.cur_oquestion)
...@@ -129,10 +129,10 @@ class QA: ...@@ -129,10 +129,10 @@ class QA:
_question = history[-1][0] _question = history[-1][0]
history = history[:-1] history = history[:-1]
if self.contains_blocked_keywords(_question): # if self.contains_blocked_keywords(_question):
self.cur_answer = SAFE_RESPONSE # self.cur_answer = SAFE_RESPONSE
yield [(_question, self.cur_answer)] # yield [(_question, self.cur_answer)]
return # return
self.cur_similarity = self.get_similarity(_aquestion=_question) self.cur_similarity = self.get_similarity(_aquestion=_question)
self.cur_question = self.prompt.format(context=self.cur_similarity, question=_question) self.cur_question = self.prompt.format(context=self.cur_similarity, question=_question)
......
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