fix: 修复工作流对话bug (#1806)

(cherry picked from commit 5e42dcad09)
This commit is contained in:
shaohuzhang1 2024-12-10 16:37:57 +08:00 committed by shaohuzhang1
parent 7fa38677f7
commit f20ce4c1d2
3 changed files with 9 additions and 5 deletions

View File

@ -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,

View File

@ -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

View File

@ -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'
}
})
</script>
<style lang="scss" scoped></style>