This commit is contained in:
2026-07-06 16:19:48 +08:00
parent d7f7d68f39
commit 0dd9637725
+44 -20
View File
@@ -59,6 +59,10 @@
<el-form-item v-if="currentNodeisSaveFile" label="是否保存文件">
<el-switch v-model="isSaveFileEnabled" active-text="开启" inactive-text="关闭" />
</el-form-item>
<!-- 贴片布局开关如果节点支持 -->
<el-form-item v-if="currentNodePatchLayout" label="贴片布局">
<el-switch v-model="patchLayoutEnabled" active-text="开启" inactive-text="关闭" />
</el-form-item>
<!-- 模型选择如果有模型配置 -->
<el-form-item v-if="currentNodeModelConfig.length > 0" label="选择模型">
<div class="model-selector-wrapper">
@@ -408,12 +412,6 @@
</template>
</template>
<el-empty v-else description="暂无表单配置" :image-size="80" />
<!-- 贴片模板编辑器(工作流包含贴片节点时显示) -->
<PatchTemplateEditor
v-if="currentWorkflowHasPatchLayout"
v-model="templates"
/>
</el-form>
</div>
</div>
@@ -901,6 +899,7 @@ const selectedSkill = ref<SkillItem | null>(null);
const showPromptSelector = ref(false);
const promptContent = ref('');
const isSaveFileEnabled = ref(false);
const patchLayoutEnabled = ref(false);
const templates = ref<any[]>([]);
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 = [];
}
});