diff --git a/apps/application/workflow/nodes/image_understand_node/image_understand_node.py b/apps/application/workflow/nodes/image_understand_node/image_understand_node.py index 6882d3e5fc3..61dcb32e3dc 100644 --- a/apps/application/workflow/nodes/image_understand_node/image_understand_node.py +++ b/apps/application/workflow/nodes/image_understand_node/image_understand_node.py @@ -107,7 +107,10 @@ def execute(self): history_message = self._get_history_message(history_chat_record, dialogue_number) message_list = self._generate_message_list(chat_model, system, prompt, history_message, image) - self.write_context("message_list", message_list) + self.write_context( + "message_list", + [{"content": m.content, "role": m.type} for m in message_list], + ) self._generate_context_image(image) self.write_context("dialogue_type", dialogue_type) diff --git a/ui/src/workflow-canvas/component/NodeMenu.vue b/ui/src/workflow-canvas/component/NodeMenu.vue index 617e2f3bff1..b018c48bdf1 100644 --- a/ui/src/workflow-canvas/component/NodeMenu.vue +++ b/ui/src/workflow-canvas/component/NodeMenu.vue @@ -30,6 +30,7 @@ const workflowComponentGroups = [ { 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.ImageGenerateNode}, + { icon: aiChatIcon, iconClass: 'bg-primary-gradient', label: '图片理解', value: WorkflowNodeType.ImageUnderstandNode}, { icon: aiChatIcon, iconClass: 'bg-primary-gradient', label: '问题优化', value: WorkflowNodeType.Question}, ], }, diff --git a/ui/src/workflow-canvas/icons/image-understand-node-icon.vue b/ui/src/workflow-canvas/icons/image-understand-node-icon.vue new file mode 100644 index 00000000000..7a220814144 --- /dev/null +++ b/ui/src/workflow-canvas/icons/image-understand-node-icon.vue @@ -0,0 +1,6 @@ + + diff --git a/ui/src/workflow-canvas/nodes/image-understand-node/index.ts b/ui/src/workflow-canvas/nodes/image-understand-node/index.ts new file mode 100644 index 00000000000..8923c8faf14 --- /dev/null +++ b/ui/src/workflow-canvas/nodes/image-understand-node/index.ts @@ -0,0 +1,15 @@ +import ImageUnderstandNodeVue from './index.vue' +import { WorkflowNodeModel, WorkflowNodeView } from '@/workflow-canvas/core/workflow-node' +import { WorkflowNodeType } from '@/workflow-canvas/types.ts' + +class ImageUnderstandNodeView extends WorkflowNodeView { + constructor(props: ConstructorParameters[0]) { + super(props, ImageUnderstandNodeVue) + } +} + +export default { + type: WorkflowNodeType.ImageUnderstandNode, + model: WorkflowNodeModel, + view: ImageUnderstandNodeView, +} diff --git a/ui/src/workflow-canvas/nodes/image-understand-node/index.vue b/ui/src/workflow-canvas/nodes/image-understand-node/index.vue new file mode 100644 index 00000000000..cdc294a066c --- /dev/null +++ b/ui/src/workflow-canvas/nodes/image-understand-node/index.vue @@ -0,0 +1,227 @@ + + + +