From 7fb3fb10e95f7128dd30bc02da5f5bd561ad8671 Mon Sep 17 00:00:00 2001 From: zhangzhanwei Date: Mon, 16 Mar 2026 15:46:37 +0800 Subject: [PATCH 1/2] fix: Tool workflow node result --- ui/src/workflow/common/data.ts | 4 ---- .../nodes/tool-workflow-lib-node/index.ts | 3 +++ .../nodes/tool-workflow-lib-node/index.vue | 22 +++++++++---------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/ui/src/workflow/common/data.ts b/ui/src/workflow/common/data.ts index e8365e2b825..ea80cb8860a 100644 --- a/ui/src/workflow/common/data.ts +++ b/ui/src/workflow/common/data.ts @@ -1050,10 +1050,6 @@ export const toolWorkflowLibNode = { stepName: t('workflow.nodes.toolWorlflowNode.label','工作流工具'), config: { fields: [ - { - label: t('common.result'), - value: 'result', - }, ], }, }, diff --git a/ui/src/workflow/nodes/tool-workflow-lib-node/index.ts b/ui/src/workflow/nodes/tool-workflow-lib-node/index.ts index fea8d415d94..bb896f90846 100644 --- a/ui/src/workflow/nodes/tool-workflow-lib-node/index.ts +++ b/ui/src/workflow/nodes/tool-workflow-lib-node/index.ts @@ -4,6 +4,9 @@ class ToolWorkflowLibNode extends AppNode { constructor(props: any) { super(props, ToolWorkflowLibNodeVue) } + getConfig(props: any) { + return props.model.properties.config + } } export default { type: 'tool-workflow-lib-node', diff --git a/ui/src/workflow/nodes/tool-workflow-lib-node/index.vue b/ui/src/workflow/nodes/tool-workflow-lib-node/index.vue index a04796c15a9..91933a99807 100644 --- a/ui/src/workflow/nodes/tool-workflow-lib-node/index.vue +++ b/ui/src/workflow/nodes/tool-workflow-lib-node/index.vue @@ -150,8 +150,6 @@ const update_field = () => { loadSharedApi({ type: 'tool', systemType: apiType.value }) .getToolById(props.nodeModel.properties.node_data.tool_lib_id) .then((ok: any) => { - console.log('ssss', ok.data) - const workflowNodes = ok.data?.work_flow?.nodes || [] const baseNode = workflowNodes.find((n: any) => n.type === 'tool-base-node') @@ -159,17 +157,14 @@ const update_field = () => { const new_input_list = baseNode.properties.user_input_field_list || [] const new_output_list = baseNode.properties.user_output_field_list || [] - let config_field_list: any[] = [] - if (new_output_list.length > 0) { - config_field_list = new_output_list.map((item: any) => ({ - label: item.label, - value: item.field, - })) - } + const old_config_fields = props.nodeModel.properties.config?.fields || [] + const config_field_list = new_output_list.map((item: any) => { + const old = old_config_fields.find((o: any) => o.value === item.field) + return old ? JSON.parse(JSON.stringify(old)) : { label: item.label, value: item.field } + }) const input_title = baseNode.properties.user_input_config?.title const output_title = baseNode.properties.user_output_config?.title - const old_input_list = props.nodeModel.properties.node_data.input_field_list || [] const merged_input_list = new_input_list.map((item: any) => { const find_field = old_input_list.find((old_item: any) => old_item.field === item.field) @@ -185,11 +180,14 @@ const update_field = () => { }) set(props.nodeModel.properties.node_data, 'input_field_list', merged_input_list) - set(props.nodeModel.properties.config, 'fields', config_field_list) + set(props.nodeModel.properties, 'config', { + fields: config_field_list, + output_title: output_title, + }) set(props.nodeModel.properties.node_data, 'input_title', input_title) - set(props.nodeModel.properties.config, 'output_title', output_title) } set(props.nodeModel.properties, 'status', ok.data.is_active ? 200 : 500) + props.nodeModel.clear_next_node_field(true) }) .catch(() => { set(props.nodeModel.properties, 'status', 500) From 9bb18c42c4468ea4f6d4e0445887530bdab91c79 Mon Sep 17 00:00:00 2001 From: zhangzhanwei Date: Wed, 18 Mar 2026 10:29:42 +0800 Subject: [PATCH 2/2] feat: Support reference model in ai chat node --- .../ai_chat_step_node/i_chat_node.py | 9 ++- .../ai_chat_step_node/impl/base_chat_node.py | 16 ++++- ui/src/workflow/nodes/ai-chat-node/index.vue | 59 ++++++++++++++----- 3 files changed, 65 insertions(+), 19 deletions(-) diff --git a/apps/application/flow/step_node/ai_chat_step_node/i_chat_node.py b/apps/application/flow/step_node/ai_chat_step_node/i_chat_node.py index c9a348c6bd0..994fda75df6 100644 --- a/apps/application/flow/step_node/ai_chat_step_node/i_chat_node.py +++ b/apps/application/flow/step_node/ai_chat_step_node/i_chat_node.py @@ -16,7 +16,10 @@ class ChatNodeSerializer(serializers.Serializer): - model_id = serializers.CharField(required=True, label=_("Model id")) + model_id = serializers.CharField(required=False, allow_blank=True, allow_null=True, label=_("Model id")) + model_id_type = serializers.CharField(required=False, default='custom', label=_("Model id type")) + model_id_reference = serializers.ListField(required=False, child=serializers.CharField(), allow_empty=True, + label=_("Reference Field")) system = serializers.CharField(required=False, allow_blank=True, allow_null=True, label=_("Role Setting")) prompt = serializers.CharField(required=True, label=_("Prompt word")) @@ -58,7 +61,7 @@ def get_node_params_serializer_class(self) -> Type[serializers.Serializer]: def _run(self): if [WorkflowMode.KNOWLEDGE, WorkflowMode.KNOWLEDGE_LOOP, WorkflowMode.TOOL, WorkflowMode.TOOL_LOOP].__contains__( - self.workflow_manage.flow.workflow_mode): + self.workflow_manage.flow.workflow_mode): return self.execute(**self.node_params_serializer.data, **self.flow_params_serializer.data, **{'history_chat_record': [], 'stream': True, 'chat_id': None, 'chat_record_id': None}) else: @@ -67,6 +70,8 @@ def _run(self): def execute(self, model_id, system, prompt, dialogue_number, history_chat_record, stream, chat_id, chat_record_id, model_params_setting=None, + model_id_type=None, + model_id_reference=None, dialogue_type=None, model_setting=None, mcp_servers=None, diff --git a/apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py b/apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py index 4fdd9680194..ec42376e91e 100644 --- a/apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py +++ b/apps/application/flow/step_node/ai_chat_step_node/impl/base_chat_node.py @@ -151,6 +151,8 @@ def save_context(self, details, workflow_manage): def execute(self, model_id, system, prompt, dialogue_number, history_chat_record, stream, chat_id, chat_record_id, model_params_setting=None, + model_id_type=None, + model_id_reference=None, dialogue_type=None, model_setting=None, mcp_servers=None, @@ -165,8 +167,20 @@ def execute(self, model_id, system, prompt, dialogue_number, history_chat_record if dialogue_type is None: dialogue_type = 'WORKFLOW' - if model_params_setting is None: + if model_id_type == 'reference' and model_id_reference: + + reference_data = self.workflow_manage.get_reference_field( + model_id_reference[0], + model_id_reference[1:], + ) + + if reference_data and isinstance(reference_data, dict): + model_id = reference_data.get('model_id', model_id) + model_params_setting = reference_data.get('model_params_setting') + + if model_params_setting is None and model_id: model_params_setting = get_default_model_params_setting(model_id) + if model_setting is None: model_setting = {'reasoning_content_enable': False, 'reasoning_content_end': '', 'reasoning_content_start': ''} diff --git a/ui/src/workflow/nodes/ai-chat-node/index.vue b/ui/src/workflow/nodes/ai-chat-node/index.vue index 460b5f8e8ee..90effb0a944 100644 --- a/ui/src/workflow/nodes/ai-chat-node/index.vue +++ b/ui/src/workflow/nodes/ai-chat-node/index.vue @@ -13,10 +13,10 @@ > @@ -28,7 +28,27 @@ }}* - + + + + + + +
+
+ +
+
- - +
+
@@ -71,7 +88,7 @@ type="primary" link @click="openGeneratePromptDialog(chat_data.model_id)" - :disabled="!chat_data.model_id" + :disabled="chat_data.model_id_type === 'reference' || !chat_data.model_id" > @@ -458,6 +475,7 @@