diff --git a/apps/application/serializers/common.py b/apps/application/serializers/common.py index 5c60512add5..b7ac4c5e411 100644 --- a/apps/application/serializers/common.py +++ b/apps/application/serializers/common.py @@ -224,7 +224,33 @@ def append_chat_record(self, chat_record: ChatRecord): else: QuerySet(Chat).filter(id=self.chat_id).update(update_time=timezone.now()) # 插入会话记录 - chat_record.save() + QuerySet(ChatRecord).update_or_create(id=chat_record.id, + create_defaults={'id': chat_record.id, + 'chat_id': chat_record.chat_id, + "vote_status": chat_record.vote_status, + 'problem_text': chat_record.problem_text, + 'answer_text': chat_record.answer_text, + 'answer_text_list': chat_record.answer_text_list, + 'message_tokens': chat_record.message_tokens, + 'answer_tokens': chat_record.answer_tokens, + 'const': chat_record.const, + 'details': chat_record.details, + 'improve_paragraph_id_list': chat_record.improve_paragraph_id_list, + 'run_time': chat_record.run_time, + 'index': chat_record.index}, + defaults={ + "vote_status": chat_record.vote_status, + 'problem_text': chat_record.problem_text, + 'answer_text': chat_record.answer_text, + 'answer_text_list': chat_record.answer_text_list, + 'message_tokens': chat_record.message_tokens, + 'answer_tokens': chat_record.answer_tokens, + 'const': chat_record.const, + 'details': chat_record.details, + 'improve_paragraph_id_list': chat_record.improve_paragraph_id_list, + 'run_time': chat_record.run_time, + 'index': chat_record.index + }) ChatCountSerializer(data={'chat_id': self.chat_id}).update_chat() def to_dict(self): diff --git a/ui/src/workflow/common/app-node.ts b/ui/src/workflow/common/app-node.ts index 8b9bedc0ad3..1894d1831e9 100644 --- a/ui/src/workflow/common/app-node.ts +++ b/ui/src/workflow/common/app-node.ts @@ -93,13 +93,17 @@ class AppNode extends HtmlResize.view { children: globalFields, }) } - result.push({ + const value: any = { value: this.props.model.id, icon: this.props.model.properties.node_data?.icon, label: this.props.model.properties.stepName, type: this.props.model.type, children: this.props.model.properties?.config?.fields || [], - }) + } + if (this.props.model.properties.kind) { + value['kind'] = this.props.model.properties.kind + } + result.push(value) return result } get_up_node_field_dict(contain_self: boolean, use_cache: boolean) { diff --git a/ui/src/workflow/icons/tool-lib-node-icon.vue b/ui/src/workflow/icons/tool-lib-node-icon.vue index 027b4e30870..a208ec38b01 100644 --- a/ui/src/workflow/icons/tool-lib-node-icon.vue +++ b/ui/src/workflow/icons/tool-lib-node-icon.vue @@ -8,7 +8,9 @@ > - + + + @@ -23,6 +25,7 @@ const props = defineProps<{ name: string icon: string tool_type: string + kind?: string } }>()