Skip to content

Commit 0ac4686

Browse files
committed
fix: 修复工作流对话bug
1 parent 672cb7d commit 0ac4686

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

apps/application/serializers/chat_message_serializers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,12 @@ def chat_work_flow(self, chat_info: ChatInfo, base_to_response):
341341
user_id = chat_info.application.user_id
342342
chat_record_id = self.data.get('chat_record_id')
343343
chat_record = None
344+
history_chat_record = chat_info.chat_record_list
344345
if chat_record_id is not None:
345346
chat_record = self.get_chat_record(chat_info, chat_record_id)
347+
history_chat_record = [r for r in chat_info.chat_record_list if str(r.id) != chat_record_id]
346348
work_flow_manage = WorkflowManage(Flow.new_instance(chat_info.work_flow_version.work_flow),
347-
{'history_chat_record': chat_info.chat_record_list, 'question': message,
349+
{'history_chat_record': history_chat_record, 'question': message,
348350
'chat_id': chat_info.chat_id, 'chat_record_id': str(
349351
uuid.uuid1()) if chat_record is None else chat_record.id,
350352
'stream': stream,

ui/src/api/type/application.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ export class ChatRecordManage {
251251
(node_info.divider_content ? node_info.divider_content.splice(0).join('') : '') +
252252
node_info.current_node.buffer.splice(0).join(''),
253253
node_info.answer_text_list_index,
254-
current_node.chat_record_id,
255-
current_node.runtime_node_id,
256-
current_node.child_node
254+
node_info.current_node.chat_record_id,
255+
node_info.current_node.runtime_node_id,
256+
node_info.current_node.child_node
257257
)
258258
if (node_info.current_node.buffer.length == 0) {
259259
node_info.current_node.is_end = true

ui/src/workflow/nodes/ai-chat-node/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,10 @@ onMounted(() => {
331331
set(props.nodeModel.properties.node_data, 'is_result', true)
332332
}
333333
}
334-
335334
set(props.nodeModel, 'validate', validate)
335+
if (!chat_data.value.dialogue_type) {
336+
chat_data.value.dialogue_type = 'WORKFLOW'
337+
}
336338
})
337339
</script>
338340
<style lang="scss" scoped></style>

0 commit comments

Comments
 (0)