mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-31 18:22:49 +00:00
fix: Application The reference segmentation of the knowledge base retrieval node in the loop body is displayed as 0 (#4466)
This commit is contained in:
parent
29e5f3c382
commit
eb41ddf151
|
|
@ -110,6 +110,16 @@ class ApplicationChatRecordQuerySerializers(serializers.Serializer):
|
|||
return [ChatRecordSerializerModel(chat_record).data for chat_record in
|
||||
QuerySet(ChatRecord).filter(chat_id=self.data.get('chat_id')).order_by(order_by)]
|
||||
|
||||
@staticmethod
|
||||
def get_loop_workflow_node(details):
|
||||
result = []
|
||||
for item in details.values():
|
||||
if item.get('type') == 'loop-node':
|
||||
for loop_item in item.get('loop_node_data') or []:
|
||||
for inner_item in loop_item.values():
|
||||
result.append(inner_item)
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def reset_chat_record(chat_record, show_source, show_exec):
|
||||
knowledge_list = []
|
||||
|
|
@ -119,7 +129,8 @@ class ApplicationChatRecordQuerySerializers(serializers.Serializer):
|
|||
paragraph_list = chat_record.details.get('search_step').get(
|
||||
'paragraph_list')
|
||||
|
||||
for item in chat_record.details.values():
|
||||
for item in [*chat_record.details.values(),
|
||||
*ApplicationChatRecordQuerySerializers.get_loop_workflow_node(chat_record.details)]:
|
||||
if item.get('type') == 'search-knowledge-node' and item.get('show_knowledge', False):
|
||||
paragraph_list = paragraph_list + (item.get(
|
||||
'paragraph_list') or [])
|
||||
|
|
|
|||
Loading…
Reference in New Issue