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' + } })