From c3d92e8dc82edb140ede306c9ba4bd0281c04137 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 28 Nov 2024 11:05:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=8F=90=E5=8F=96=E5=8F=82=E6=95=B0=E9=80=89=E6=8B=A9=E4=BA=86?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=E9=97=AE=E9=A2=98=E6=8A=A5=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049648 --user=刘瑞斌 【应用编排】文档内容提取节点,节点设置选择 “开始-用户问题” 对话报错 https://www.tapd.cn/57709429/s/1619714 --- .../document_extract_node/impl/base_document_extract_node.py | 2 +- .../impl/base_image_understand_node.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py b/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py index 4e7b2f660..1802f68d3 100644 --- a/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py +++ b/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py @@ -16,7 +16,7 @@ class BaseDocumentExtractNode(IDocumentExtractNode): self.context['document_list'] = document content = [] splitter = '\n`-----------------------------------`\n' - if document is None: + if document is None or not isinstance(document, list): return NodeResult({'content': content}, {}) for doc in document: diff --git a/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py b/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py index 813cd3158..cc077a9ca 100644 --- a/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py +++ b/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py @@ -66,6 +66,10 @@ class BaseImageUnderstandNode(IImageUnderstandNode): def execute(self, model_id, system, prompt, dialogue_number, dialogue_type, history_chat_record, stream, chat_id, chat_record_id, image, **kwargs) -> NodeResult: + # 处理不正确的参数 + if image is None or not isinstance(image, list): + image = [] + image_model = get_model_instance_by_model_user_id(model_id, self.flow_params_serializer.data.get('user_id')) # 执行详情中的历史消息不需要图片内容 history_message =self.get_history_message_for_details(history_chat_record, dialogue_number)