圆桌第三步流程图模式 + 后台 DAG 任务编排
- 方案总结报告:用户要求结构化输出/流程图时跳过 md 直出 flow-json 流程图, 报告用文字展示;报告与流程图均可多轮修改、互相切换(detectFlowIntent 识别意图) - 流程图画布放右侧沙箱位(sidePanel 插槽)不覆盖消息列表,可与 md 预览切换; 节点随容器宽度自适应缩放并 fitView 居中 - 后台挂起支持真 DAG 编排(分层并行/阶段目标/总控提示词),新增 orchestration_plan 持久化列 + 迁移;大弹窗流程图按 DAG 分层渲染 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b33426416b
commit
086c280e5d
25 files changed
+880
-149
No files matched your search
@@ -9,6 +9,7 @@ import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
|
||||
import {
|
||||
detectFlowIntent,
|
||||
extractFlowGraph,
|
||||
layoutFlowGraph,
|
||||
stripFlowFence,
|
||||
@@ -109,6 +110,24 @@ test("layoutFlowGraph:按前驱分层(根 0 层,子层递增),保持
|
||||
assert.deepEqual(positioned.map((n) => n.id), ["n1", "n2", "n3"]);
|
||||
});
|
||||
|
||||
test("detectFlowIntent:明确短语命中(编排提示 / 输入框消息)", () => {
|
||||
assert.ok(detectFlowIntent("最终总结请用结构化输出"));
|
||||
assert.ok(detectFlowIntent("总结成格式化输出"));
|
||||
assert.ok(detectFlowIntent("给我画一张流程图"));
|
||||
assert.ok(detectFlowIntent("输出可视化流程"));
|
||||
assert.ok(detectFlowIntent("请按 flow-json 契约输出"));
|
||||
assert.ok(detectFlowIntent("重点总结方案设计席位,最后给结构化数据"));
|
||||
});
|
||||
|
||||
test("detectFlowIntent:普通措辞不误触发", () => {
|
||||
assert.equal(detectFlowIntent("用表格把要点结构化呈现"), false);
|
||||
assert.equal(detectFlowIntent("把执行路线写得更细一些"), false);
|
||||
assert.equal(detectFlowIntent("面向高管汇报,控制在一页内"), false);
|
||||
assert.equal(detectFlowIntent(""), false);
|
||||
assert.equal(detectFlowIntent(null), false);
|
||||
assert.equal(detectFlowIntent(undefined), false);
|
||||
});
|
||||
|
||||
test("layoutFlowGraph:环不死循环", () => {
|
||||
const text = [
|
||||
"```flow-json",
|
||||
|
||||
@@ -212,6 +212,30 @@ export function extractFlowGraph(text: string): FlowGraphData | null {
|
||||
return { title, nodes, edges: validEdges };
|
||||
}
|
||||
|
||||
/**
|
||||
* 识别文本(业务链编排提示 / 用户输入框消息)里是否明确要求了结构化输出 / 流程图。
|
||||
* 命中 → 总结走「流程图模式」:跳过 .md 文件,报告用文字展示 + 末尾输出 flow-json。
|
||||
* 只匹配较明确的短语,避免「用表格结构化呈现」这类普通措辞误触发。
|
||||
*/
|
||||
const FLOW_INTENT_PATTERNS = [
|
||||
"流程图",
|
||||
"可视化流程",
|
||||
"结构化输出",
|
||||
"结构化数据",
|
||||
"结构化流程",
|
||||
"结构化总结",
|
||||
"格式化输出",
|
||||
"格式化总结",
|
||||
"flow-json",
|
||||
"flowchart",
|
||||
];
|
||||
|
||||
export function detectFlowIntent(text: string | null | undefined): boolean {
|
||||
if (!text) return false;
|
||||
const lower = text.toLowerCase();
|
||||
return FLOW_INTENT_PATTERNS.some((p) => lower.includes(p));
|
||||
}
|
||||
|
||||
/**
|
||||
* 把回复里的 flow-json 块替换成一句人话(气泡里不展示生 JSON)。
|
||||
* 块未闭合(流式中)→「正在输出」措辞;已闭合 → 引导去看流程图画布。
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* `DispatchChainNode`,其余类型为后续阶段预留,先一并定义好避免反复改动。
|
||||
*/
|
||||
|
||||
import type { OrchestrationPlan } from "./dag-types";
|
||||
|
||||
/** 作业状态机(§2.1)。 */
|
||||
export type JobStatus =
|
||||
| "queued" // 已创建,等待 worker 拉起
|
||||
@@ -66,8 +68,10 @@ export interface RoundtableJob {
|
||||
activeAgentId: string | null;
|
||||
consensusPercentage: number;
|
||||
pendingClarification: string | null;
|
||||
orchestrationMode: "recommend" | "chain";
|
||||
orchestrationMode: "recommend" | "chain" | "dag";
|
||||
chain: { id: string; title: string } | null;
|
||||
/** dag 模式分层编排计划(流程图按 stage 分层绘制);非 dag 为 null。 */
|
||||
orchestrationPlan: OrchestrationPlan | null;
|
||||
error: string | null;
|
||||
/** 研讨对话记录(leader 说明 + 各席位交付),跑完 / 进行中都可看真实内容。 */
|
||||
dialogues: JobDialogue[];
|
||||
@@ -85,8 +89,10 @@ export interface StartJobPayload {
|
||||
/** 有序席位(recommend=选择顺序 / chain=链条顺序)。 */
|
||||
agents: Array<{ agentId: string; name: string }>;
|
||||
model?: string;
|
||||
orchestrationMode?: "recommend" | "chain";
|
||||
orchestrationMode?: "recommend" | "chain" | "dag";
|
||||
chain?: { id: string; title: string } | null;
|
||||
/** dag 模式分层编排计划(stages / 阶段目标 / 总控提示词 / finalSynthesis)。非 dag 省略。 */
|
||||
orchestrationPlan?: OrchestrationPlan | null;
|
||||
/** 显式第一轮 leader prompt(覆盖 intent)。 */
|
||||
seedMessage?: string;
|
||||
/** 预建好的 thread 映射(Phase 3b 真网关用;模拟网关忽略)。 */
|
||||
|
||||
Reference in new issue
Block a user