diff --git a/apps/application/workflow/nodes/question_node/question_node.py b/apps/application/workflow/nodes/question_node/question_node.py index c11d568f92d..861eae9d594 100644 --- a/apps/application/workflow/nodes/question_node/question_node.py +++ b/apps/application/workflow/nodes/question_node/question_node.py @@ -117,7 +117,10 @@ def execute(self): message_list = [SystemMessage(system), *history_message, question] else: message_list = [*history_message, question] - self.write_context("message_list", message_list) + self.write_context( + "message_list", + [{"content": m.content, "role": m.type} for m in message_list], + ) response = chat_model.stream(message_list) answer = "" diff --git a/ui/src/workflow-canvas/component/NodeMenu.vue b/ui/src/workflow-canvas/component/NodeMenu.vue index 44f7863ecd5..2545376dab2 100644 --- a/ui/src/workflow-canvas/component/NodeMenu.vue +++ b/ui/src/workflow-canvas/component/NodeMenu.vue @@ -29,6 +29,7 @@ const workflowComponentGroups = [ { icon: aiChatIcon, iconClass: 'bg-primary-gradient', label: 'AI 对话', value: WorkflowNodeType.AiChat }, { icon: aiChatIcon, iconClass: 'bg-primary-gradient', label: '意图识别', value: WorkflowNodeType.IntentNode }, { icon: aiChatIcon, iconClass: 'bg-primary-gradient', label: '文本转语音', value: WorkflowNodeType.TextToSpeechNode }, + { icon: aiChatIcon, iconClass: 'bg-primary-gradient', label: '问题优化', value: WorkflowNodeType.Question}, ], }, { diff --git a/ui/src/workflow-canvas/icons/question-node-icon.vue b/ui/src/workflow-canvas/icons/question-node-icon.vue new file mode 100644 index 00000000000..7a220814144 --- /dev/null +++ b/ui/src/workflow-canvas/icons/question-node-icon.vue @@ -0,0 +1,6 @@ + + diff --git a/ui/src/workflow-canvas/nodes/intent-node/index.ts b/ui/src/workflow-canvas/nodes/intent-node/index.ts index 0bab7750ca9..8130608ab09 100644 --- a/ui/src/workflow-canvas/nodes/intent-node/index.ts +++ b/ui/src/workflow-canvas/nodes/intent-node/index.ts @@ -22,7 +22,7 @@ interface IntentNodeData { } /** 节点顶部到第一个分类行锚点的纵向偏移(近似)。 */ -const BRANCH_ANCHOR_TOP_OFFSET = 422 +const BRANCH_ANCHOR_TOP_OFFSET = 400 /** 相邻分类行锚点的纵向间距(近似行高)。 */ const BRANCH_ANCHOR_GAP = 40 diff --git a/ui/src/workflow-canvas/nodes/question-node/index.ts b/ui/src/workflow-canvas/nodes/question-node/index.ts new file mode 100644 index 00000000000..95813405f45 --- /dev/null +++ b/ui/src/workflow-canvas/nodes/question-node/index.ts @@ -0,0 +1,15 @@ +import QuestionNodeVue from './index.vue' +import { WorkflowNodeModel, WorkflowNodeView } from '@/workflow-canvas/core/workflow-node' +import { WorkflowNodeType } from '@/workflow-canvas/types.ts' + +class QuestionNodeView extends WorkflowNodeView { + constructor(props: ConstructorParameters[0]) { + super(props, QuestionNodeVue) + } +} + +export default { + type: WorkflowNodeType.Question, + model: WorkflowNodeModel, + view: QuestionNodeView, +} diff --git a/ui/src/workflow-canvas/nodes/question-node/index.vue b/ui/src/workflow-canvas/nodes/question-node/index.vue new file mode 100644 index 00000000000..d82b73bf73e --- /dev/null +++ b/ui/src/workflow-canvas/nodes/question-node/index.vue @@ -0,0 +1,204 @@ + + + +