Skip to content

Commit 80aeecf

Browse files
committed
refactor: 执行详情里展示文档提取日志时多个文件单独显示,最多500字符
1 parent 2a07a50 commit 80aeecf

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from application.flow.i_step_node import NodeResult
99
from application.flow.step_node.document_extract_node.i_document_extract_node import IDocumentExtractNode
10-
from application.models import Chat
1110
from dataset.models import File
1211
from dataset.serializers.document_serializers import split_handles, parse_table_handle_list, FileBufferHandle
1312
from dataset.serializers.file_serializers import FileSerializer
@@ -36,15 +35,16 @@ def bytes_to_uploaded_file(file_bytes, file_name="file.txt"):
3635
return uploaded_file
3736

3837

38+
splitter = '\n`-----------------------------------`\n'
39+
3940
class BaseDocumentExtractNode(IDocumentExtractNode):
4041
def execute(self, document, chat_id, **kwargs):
4142
get_buffer = FileBufferHandle().get_buffer
4243

4344
self.context['document_list'] = document
4445
content = []
45-
splitter = '\n`-----------------------------------`\n'
4646
if document is None or not isinstance(document, list):
47-
return NodeResult({'content': content}, {})
47+
return NodeResult({'content': ''}, {})
4848

4949
application = self.workflow_manage.work_flow_post_handler.chat_info.application
5050

@@ -76,14 +76,14 @@ def save_image(image_list):
7676
return NodeResult({'content': splitter.join(content)}, {})
7777

7878
def get_details(self, index: int, **kwargs):
79+
content = self.context.get('content', '').split(splitter)
7980
# 不保存content全部内容,因为content内容可能会很大
80-
content = (self.context.get('content')[:500] + '...') if len(self.context.get('content')) > 0 else ''
8181
return {
8282
'name': self.node.properties.get('stepName'),
8383
"index": index,
8484
'run_time': self.context.get('run_time'),
8585
'type': self.node.type,
86-
'content': content,
86+
'content': [file_content[:500] for file_content in content],
8787
'status': self.status,
8888
'err_message': self.err_message,
8989
'document_list': self.context.get('document_list')

ui/src/components/ai-chat/ExecutionDetailDialog.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,13 @@
231231
</h5>
232232
<div class="p-8-12 border-t-dashed lighter">
233233
<el-scrollbar height="150">
234-
<el-card shadow="never" style="--el-card-padding: 8px">
234+
<el-card shadow="never" style="--el-card-padding: 8px" v-for="(file_content, index) in item.content"
235+
:key="index" class="mb-8">
235236
<MdPreview
236-
v-if="item.content"
237+
v-if="file_content"
237238
ref="editorRef"
238239
editorId="preview-only"
239-
:modelValue="item.content"
240+
:modelValue="file_content"
240241
style="background: none"
241242
/>
242243
<template v-else> - </template>

0 commit comments

Comments
 (0)