From f20ce4c1d2b68efe2b295dcaa24b26b4e63736f1 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:37:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E5=AF=B9=E8=AF=9Dbug=20(#1806)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 5e42dcad09013933388ca72762894ca9a5118827) --- apps/application/serializers/chat_message_serializers.py | 4 +++- ui/src/api/type/application.ts | 6 +++--- ui/src/workflow/nodes/ai-chat-node/index.vue | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/application/serializers/chat_message_serializers.py b/apps/application/serializers/chat_message_serializers.py index c6374c914..84e8376e0 100644 --- a/apps/application/serializers/chat_message_serializers.py +++ b/apps/application/serializers/chat_message_serializers.py @@ -341,10 +341,12 @@ class ChatMessageSerializer(serializers.Serializer): user_id = chat_info.application.user_id chat_record_id = self.data.get('chat_record_id') chat_record = None + history_chat_record = chat_info.chat_record_list if chat_record_id is not None: chat_record = self.get_chat_record(chat_info, chat_record_id) + history_chat_record = [r for r in chat_info.chat_record_list if str(r.id) != chat_record_id] work_flow_manage = WorkflowManage(Flow.new_instance(chat_info.work_flow_version.work_flow), - {'history_chat_record': chat_info.chat_record_list, 'question': message, + {'history_chat_record': history_chat_record, 'question': message, 'chat_id': chat_info.chat_id, 'chat_record_id': str( uuid.uuid1()) if chat_record is None else chat_record.id, 'stream': stream, diff --git a/ui/src/api/type/application.ts b/ui/src/api/type/application.ts index 95812bbab..c1d07c968 100644 --- a/ui/src/api/type/application.ts +++ b/ui/src/api/type/application.ts @@ -251,9 +251,9 @@ export class ChatRecordManage { (node_info.divider_content ? node_info.divider_content.splice(0).join('') : '') + node_info.current_node.buffer.splice(0).join(''), node_info.answer_text_list_index, - current_node.chat_record_id, - current_node.runtime_node_id, - current_node.child_node + node_info.current_node.chat_record_id, + node_info.current_node.runtime_node_id, + node_info.current_node.child_node ) if (node_info.current_node.buffer.length == 0) { node_info.current_node.is_end = true diff --git a/ui/src/workflow/nodes/ai-chat-node/index.vue b/ui/src/workflow/nodes/ai-chat-node/index.vue index 6071c48c4..f68702995 100644 --- a/ui/src/workflow/nodes/ai-chat-node/index.vue +++ b/ui/src/workflow/nodes/ai-chat-node/index.vue @@ -331,8 +331,10 @@ onMounted(() => { set(props.nodeModel.properties.node_data, 'is_result', true) } } - set(props.nodeModel, 'validate', validate) + if (!chat_data.value.dialogue_type) { + chat_data.value.dialogue_type = 'WORKFLOW' + } })