首页执行工作流:贴片模板写入开启贴片布局的节点内部(与 modelConfig 平级)
- templates 不再放 flowContent 最外层,改为写入 patchLayout===true 的节点内部(数组),后端执行从节点读取 - 删除 detail.flowContent 可能遗留的顶层 templates,统一走节点 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1025,13 +1025,17 @@ const runWorkflow = async (
|
||||
const nodeInputParams = JSON.parse(JSON.stringify(detail.nodeInputParams || []));
|
||||
applyHomeFormValues(nodeInputParams, opts.formValues, opts.formFileNames);
|
||||
|
||||
// 2. 构建 flowContent
|
||||
const updatedFlowContent = {
|
||||
...detail.flowContent,
|
||||
nodes: nodeInputParams,
|
||||
// 贴片模板:表单卡片编辑后随提交回传(后端从 flowContent.templates 读取,空数组也如实提交表示清空)
|
||||
...(Array.isArray(opts.templates) ? { templates: opts.templates } : {}),
|
||||
};
|
||||
// 贴片模板写入开启贴片布局的节点内部(与 modelConfig 平级,数组),后端执行从节点读取;
|
||||
// 空数组也如实写入表示清空;无贴片节点的模板不写
|
||||
if (Array.isArray(opts.templates)) {
|
||||
nodeInputParams.forEach((n: any) => {
|
||||
if (n.patchLayout === true) n.templates = opts.templates;
|
||||
});
|
||||
}
|
||||
|
||||
// 构建 flowContent:templates 不再放最外层(删除 detail.flowContent 可能遗留的顶层 templates,统一走节点)
|
||||
const updatedFlowContent: any = { ...detail.flowContent, nodes: nodeInputParams };
|
||||
delete updatedFlowContent.templates;
|
||||
|
||||
// 3. 工作流模型由后端按 flow 配置决定,无需前端取模型 id(普通对话取模型见 runChat)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user