恢复贴片相关
This commit is contained in:
@@ -336,6 +336,7 @@ export interface ExecuteFlowParams {
|
||||
sessionId?: string;
|
||||
skillName?: string;
|
||||
resultUrl?: string;
|
||||
templates?: any[];
|
||||
}
|
||||
|
||||
export function executeFlow(data: ExecuteFlowParams | FormData, requestOptions?: RequestOptions) {
|
||||
|
||||
@@ -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)"
|
||||
>
|
||||
<el-button size="small" type="primary" :disabled="!!template.url">
|
||||
|
||||
@@ -412,6 +412,12 @@
|
||||
</template>
|
||||
</template>
|
||||
<el-empty v-else description="暂无表单配置" :image-size="80" />
|
||||
|
||||
<!-- 贴片模板编辑器(工作流包含贴片节点时显示) -->
|
||||
<PatchTemplateEditor
|
||||
v-if="currentWorkflowHasPatchLayout"
|
||||
v-model="templates"
|
||||
/>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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 = [];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user