fix: The simple application of stream=false Q&A will also directly return segmented content when the similarity is not enough (#2073)

This commit is contained in:
shaohuzhang1 2025-01-22 17:36:03 +08:00 committed by GitHub
parent 21d505a8d0
commit 34b626d425
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -208,10 +208,9 @@ class BaseChatStep(IChatStep):
problem_text=None):
if paragraph_list is None:
paragraph_list = []
directly_return_chunk_list = [AIMessage(content=paragraph.content)
for paragraph in paragraph_list if
paragraph.hit_handling_method == 'directly_return']
directly_return_chunk_list = [AIMessageChunk(content=paragraph.content)
for paragraph in paragraph_list if (
paragraph.hit_handling_method == 'directly_return' and paragraph.similarity >= paragraph.directly_return_similarity)]
if directly_return_chunk_list is not None and len(directly_return_chunk_list) > 0:
return directly_return_chunk_list[0], False
elif len(paragraph_list) == 0 and no_references_setting.get(