From 0dd96377253e09f5fcdc6f35b03bcd369ba0ad3a Mon Sep 17 00:00:00 2001 From: 2910410219 <2910410219@qq.com> Date: Mon, 6 Jul 2026 16:19:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/settings/creation/index.vue | 64 ++++++++++++++++++--------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/src/views/settings/creation/index.vue b/src/views/settings/creation/index.vue index 523f7da..5184d62 100644 --- a/src/views/settings/creation/index.vue +++ b/src/views/settings/creation/index.vue @@ -59,6 +59,10 @@ + + + +
@@ -408,12 +412,6 @@ - - -
@@ -901,6 +899,7 @@ const selectedSkill = ref(null); const showPromptSelector = ref(false); const promptContent = ref(''); const isSaveFileEnabled = ref(false); +const patchLayoutEnabled = ref(false); const templates = ref([]); const saving = ref(false); const leftPanelTab = ref('selected'); // 默认显示"当前选中"Tab @@ -1081,21 +1080,17 @@ const currentNodeisSaveFile = computed(() => { }); return isSaveFile; }); -// 判断当前工作流是否包含支持贴片布局的节点 -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; - } +// 获取当前节点是否支持贴片布局 +const currentNodePatchLayout = computed(() => { + let patchLayout = false; + nodeLibraryGroups.value.forEach((group) => { + (group.items || []).forEach((item) => { + if (item.nodeCode === formState.nodeCode) { + patchLayout = item.patchLayout || false; } - } - return false; + }); }); + return patchLayout; }); // 获取当前节点的模型类型 const currentNodeModelType = computed(() => { @@ -1367,6 +1362,8 @@ const workflowDsl = computed(() => ({ : null, 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, })), @@ -2217,7 +2214,6 @@ const sendMessage = async () => { flowName: currentWorkflowForCreation.value.flowName || currentWorkflowForCreation.value.flowTemplateName, // 工作流名称 fileUrl: fileUrls, // 添加文件 URL 数组 resultUrl: currentWorkflowForCreation.value.resultUrl || '', // 添加结果节点 URL - templates: templates.value, }; // 5. 调用执行接口(不再使用 FormData,直接传 JSON) @@ -3475,6 +3471,12 @@ watch( // 恢复对话模式状态 isSaveFileEnabled.value = e?.properties?.isSaveFileEnabled === true; + // 恢复贴片布局状态 + patchLayoutEnabled.value = e?.properties?.patchLayoutEnabled === true; + + // 恢复贴片模板数据 + templates.value = e?.properties?.templates || []; + // 初始化所有表单字段(基础 + 模型)- 只设置还没有值的字段 allFormFields.value.forEach((fieldItem) => { const currentValue = dynamicFormValues[fieldItem.field]; @@ -3557,6 +3559,8 @@ const applySelected = () => { 'skillName', 'promptContent', 'isSaveFileEnabled', + patchLayoutEnabled, + templates, 'width', 'height', ]; @@ -3621,6 +3625,16 @@ const applySelected = () => { // 保存对话模式状态 p.isSaveFileEnabled = isSaveFileEnabled.value; + // 保存贴片布局状态 + p.patchLayoutEnabled = patchLayoutEnabled.value; + + // 保存贴片模板数据 + if (templates.value.length > 0) { + p.templates = templates.value; + } else { + delete p.templates; + } + // 不再保存基础字段到根级别,所有字段都通过 formConfig 保存 // 保存字段元数据(label、type、required等) @@ -4045,6 +4059,8 @@ const loadWorkflowFromDsl = (dsl: any) => { inputSource: n.inputSource || null, // 加载提示词和保存文件配置 isSaveFileEnabled: n.isSaveFile ?? false, + patchLayoutEnabled: n.patchLayout ?? false, + templates: n.templates || [], promptContent: n.promptContent || '', }, }; @@ -4102,6 +4118,12 @@ watch(selectedElement, (newElement) => { // 从节点属性中恢复对话模式状态 isSaveFileEnabled.value = newElement.properties.isSaveFileEnabled === true; + + // 从节点属性中恢复贴片布局状态 + patchLayoutEnabled.value = newElement.properties.patchLayoutEnabled === true; + + // 从节点属性中恢复贴片模板数据 + templates.value = newElement.properties.templates || []; } else { // 如果不是节点或没有选中元素,清空状态 selectedModel.value = ''; @@ -4109,6 +4131,8 @@ watch(selectedElement, (newElement) => { selectedSkill.value = null; promptContent.value = ''; isSaveFileEnabled.value = false; + patchLayoutEnabled.value = false; + templates.value = []; } });