feat(orchestration): Phase2 —— map 真并行 fan-out + branch 真/假边标签精确选路
Phase1 让引擎按图执行后,本轮补上两块:
1) map 并行 fan-out(dispatcher)
- map 节点:planItems 把主题拆成 3–6 子项 → 复用 report 的 writeSections
有界并发(4)逐项撰写 → 结构化 sections 存黑板 + 拼进 answer + 流式呈现。
- 检索节点记下 owner 作用域库名(b.kb),供 map 各项并行检索复用。
- render 节点优先用 map 产出的多章 sections 渲染,否则整段成稿当单章。
2) branch 真/假边标签(前端 + DSL + dispatcher)
- TypedNode:分支节点渲染两个出口手柄 真(绿)/假(红),连线各带 sourceHandle。
- exportDsl / TaskDsl:边导出携带 sourceHandle。
- dispatcher dsl.Edge 增 SourceHandle;branchNode 优先按 true/false 标签精确
选路,无标签的旧图退回"出边顺序"约定,向后兼容。
实测(gateway+dispatcher+DeepSeek 真跑):
- map:input→map→render,DeepSeek 拆出 5 章并行撰写(347–512字),trace 见
section:0..4 并发 + 有界并发(section3 等槽);render 因 mcp-go 不在优雅降级 ✓
- branch 标签:把 true 边故意列第二位,条件真仍走 true 标签的分支A、假走分支B,
证明按标签而非边序选路 ✓
- 桌面端:分支节点正确渲染 真/假 两手柄,无 console 报错 ✓
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,8 @@ import { NODE_KINDS } from "../studio/nodeCatalog";
|
||||
export interface TaskDsl {
|
||||
version: "1";
|
||||
nodes: Array<{ id: string; kind: string; label?: string; config: unknown }>;
|
||||
edges: Array<{ source: string; target: string }>;
|
||||
// sourceHandle 标记从 branch 节点引出的边走真/假分支("true"/"false")。
|
||||
edges: Array<{ source: string; target: string; sourceHandle?: string }>;
|
||||
}
|
||||
|
||||
// exportDsl 把画布的节点/连线导出为类型化 JSON DSL。
|
||||
@@ -16,7 +17,11 @@ export function exportDsl(nodes: Node[], edges: Edge[]): TaskDsl {
|
||||
const d = n.data as { kind: string; label?: string; config?: unknown };
|
||||
return { id: n.id, kind: d.kind, label: d.label, config: d.config ?? {} };
|
||||
}),
|
||||
edges: edges.map((e) => ({ source: e.source, target: e.target })),
|
||||
edges: edges.map((e) => ({
|
||||
source: e.source,
|
||||
target: e.target,
|
||||
...(e.sourceHandle ? { sourceHandle: e.sourceHandle } : {}),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user