From cce0bc64481dd81a874f07323b7049c618071eae Mon Sep 17 00:00:00 2001 From: 2910410219 <2910410219@qq.com> Date: Mon, 6 Jul 2026 16:46:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E8=B4=B4=E7=89=87=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/settings/creation/index.ts | 1 + .../patchTemplate/PatchTemplateEditor.vue | 2 +- src/views/settings/creation/index.vue | 36 ++++++++++++------- src/views/settings/workflow/index.vue | 6 ++-- 4 files changed, 28 insertions(+), 17 deletions(-) diff --git a/src/api/settings/creation/index.ts b/src/api/settings/creation/index.ts index cdb428e..eeeb9f7 100644 --- a/src/api/settings/creation/index.ts +++ b/src/api/settings/creation/index.ts @@ -336,6 +336,7 @@ export interface ExecuteFlowParams { sessionId?: string; skillName?: string; resultUrl?: string; + templates?: any[]; } export function executeFlow(data: ExecuteFlowParams | FormData, requestOptions?: RequestOptions) { diff --git a/src/components/patchTemplate/PatchTemplateEditor.vue b/src/components/patchTemplate/PatchTemplateEditor.vue index 977b84e..e22d3a2 100644 --- a/src/components/patchTemplate/PatchTemplateEditor.vue +++ b/src/components/patchTemplate/PatchTemplateEditor.vue @@ -17,7 +17,7 @@ :key="`upload-${index}`" :auto-upload="false" :show-file-list="false" - :accept="'.html,.htm'" + :accept="'.html,.htm'" :on-change="(file: any) => handleTemplateUpload(index, file)" > diff --git a/src/views/settings/creation/index.vue b/src/views/settings/creation/index.vue index 5184d62..7ae3aa7 100644 --- a/src/views/settings/creation/index.vue +++ b/src/views/settings/creation/index.vue @@ -412,6 +412,12 @@ + + + @@ -1092,6 +1098,22 @@ const currentNodePatchLayout = computed(() => { }); return patchLayout; }); +// 判断当前工作流是否包含支持贴片布局的节点 +const currentWorkflowHasPatchLayout = computed(() => { + const nodes = currentWorkflowForCreation.value?.nodeInputParams || []; + if (!nodes.length || !nodeLibraryGroups.value.length) return false; + return nodes.some((node: any) => { + if (!node.nodeCode) return false; + for (const group of nodeLibraryGroups.value) { + for (const item of group.items || []) { + if (item.nodeCode === node.nodeCode && item.patchLayout) { + return true; + } + } + } + return false; + }); +}); // 获取当前节点的模型类型 const currentNodeModelType = computed(() => { const currentNodeCode = String(formState.nodeCode || '').trim(); @@ -1363,7 +1385,6 @@ const workflowDsl = computed(() => ({ outputConfig: Array.isArray(n.properties?.outputConfig) ? n.properties.outputConfig : null, isSaveFile: n.properties?.isSaveFileEnabled ?? null, patchLayout: n.properties?.patchLayoutEnabled ?? null, - templates: n.properties?.templates ?? null, promptContent: n.properties?.promptContent || '', outputResult: null, })), @@ -2214,6 +2235,7 @@ const sendMessage = async () => { flowName: currentWorkflowForCreation.value.flowName || currentWorkflowForCreation.value.flowTemplateName, // 工作流名称 fileUrl: fileUrls, // 添加文件 URL 数组 resultUrl: currentWorkflowForCreation.value.resultUrl || '', // 添加结果节点 URL + templates: templates.value, }; // 5. 调用执行接口(不再使用 FormData,直接传 JSON) @@ -3474,8 +3496,6 @@ watch( // 恢复贴片布局状态 patchLayoutEnabled.value = e?.properties?.patchLayoutEnabled === true; - // 恢复贴片模板数据 - templates.value = e?.properties?.templates || []; // 初始化所有表单字段(基础 + 模型)- 只设置还没有值的字段 allFormFields.value.forEach((fieldItem) => { @@ -3560,7 +3580,6 @@ const applySelected = () => { 'promptContent', 'isSaveFileEnabled', patchLayoutEnabled, - templates, 'width', 'height', ]; @@ -3628,12 +3647,6 @@ const applySelected = () => { // 保存贴片布局状态 p.patchLayoutEnabled = patchLayoutEnabled.value; - // 保存贴片模板数据 - if (templates.value.length > 0) { - p.templates = templates.value; - } else { - delete p.templates; - } // 不再保存基础字段到根级别,所有字段都通过 formConfig 保存 @@ -4060,7 +4073,6 @@ const loadWorkflowFromDsl = (dsl: any) => { // 加载提示词和保存文件配置 isSaveFileEnabled: n.isSaveFile ?? false, patchLayoutEnabled: n.patchLayout ?? false, - templates: n.templates || [], promptContent: n.promptContent || '', }, }; @@ -4123,7 +4135,6 @@ watch(selectedElement, (newElement) => { patchLayoutEnabled.value = newElement.properties.patchLayoutEnabled === true; // 从节点属性中恢复贴片模板数据 - templates.value = newElement.properties.templates || []; } else { // 如果不是节点或没有选中元素,清空状态 selectedModel.value = ''; @@ -4132,7 +4143,6 @@ watch(selectedElement, (newElement) => { promptContent.value = ''; isSaveFileEnabled.value = false; patchLayoutEnabled.value = false; - templates.value = []; } }); diff --git a/src/views/settings/workflow/index.vue b/src/views/settings/workflow/index.vue index 03c2802..27e5314 100644 --- a/src/views/settings/workflow/index.vue +++ b/src/views/settings/workflow/index.vue @@ -298,11 +298,11 @@ const addParam = (param: ParamRef) => { }; // 查找是否已存在该节点的引用 - const existingIndex = updatedNode.data.inputSource!.findIndex((item) => item.nodeId === param.id); + const existingIndex = updatedNode.data!.inputSource!.findIndex((item) => item.nodeId === param.id); if (existingIndex >= 0) { // 已存在,添加 output 到 field 数组 - const existing = updatedNode.data.inputSource![existingIndex]; + const existing = updatedNode.data!.inputSource![existingIndex]; if (!existing.field.includes('output')) { existing.field.push('output'); selectedNode.value = updatedNode; @@ -318,7 +318,7 @@ const addParam = (param: ParamRef) => { } } else { // 不存在,创建新的引用 - updatedNode.data.inputSource!.push({ + updatedNode.data!.inputSource!.push({ nodeId: param.id, field: ['output'], quoteOutput: false,