Skip to content

Commit

Permalink
fix: The simple application of stream=false Q&A will also directly re…
Browse files Browse the repository at this point in the history
…turn segmented content when the similarity is not enough
  • Loading branch information
shaohuzhang1 committed Jan 22, 2025
1 parent 21d505a commit c4304cf
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,9 @@ def get_block_result(message_list: List[BaseMessage],
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(
Expand Down

0 comments on commit c4304cf

Please sign in to comment.