Skip to content

Commit ebfa579

Browse files
committed
fix: Application The reference segmentation of the knowledge base retrieval node in the loop body is displayed as 0
1 parent 29e5f3c commit ebfa579

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

apps/application/serializers/application_chat_record.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ def list(self, with_valid=True):
110110
return [ChatRecordSerializerModel(chat_record).data for chat_record in
111111
QuerySet(ChatRecord).filter(chat_id=self.data.get('chat_id')).order_by(order_by)]
112112

113+
@staticmethod
114+
def get_loop_workflow_node(details):
115+
result = []
116+
for item in details.values():
117+
if item.get('type') == 'loop-node':
118+
for loop_item in item.get('loop_node_data') or []:
119+
for inner_item in loop_item.values():
120+
result.append(inner_item)
121+
return result
122+
113123
@staticmethod
114124
def reset_chat_record(chat_record, show_source, show_exec):
115125
knowledge_list = []
@@ -119,7 +129,8 @@ def reset_chat_record(chat_record, show_source, show_exec):
119129
paragraph_list = chat_record.details.get('search_step').get(
120130
'paragraph_list')
121131

122-
for item in chat_record.details.values():
132+
for item in [*chat_record.details.values(),
133+
*ApplicationChatRecordQuerySerializers.get_loop_workflow_node(chat_record.details)]:
123134
if item.get('type') == 'search-knowledge-node' and item.get('show_knowledge', False):
124135
paragraph_list = paragraph_list + (item.get(
125136
'paragraph_list') or [])

0 commit comments

Comments
 (0)