feat: 第三步流程图后端抽取智能体 + 意图识别 + 问答/画布编辑
- 新增专职「结构化抽取智能体」roundtable-structure(种子资产 SOUL+config,注册进 seeder 启动 seed+sync 进 DB,可在智能体管理页编辑、未来挂入库技能)。 - /api/flow-extract/stream 改用该 agent 的 SOUL(load_agent_soul,缺失回退内置默认) + 模型(前端所选 > agent 配置 > 默认);抽取/校验/编辑统一。SOUL 先输出简要分析过程再出 flow-json,模型慢时也有实时反馈(含 <think> 思考流)。 - 新增 /api/flow-extract/intent 意图识别(参考 ai_writing 一次性 JSON 范式):识别 重做报告/改流程图/重画流程图/提问/模糊;前端按意图分流,模糊则发起澄清让用户点选, 不再用关键词硬路由(修「说重做报告却出流程图」)。 - Phase 2 问答修改:edit 模式(当前图+指令→改图→校验);Phase 3 画布手动改/删节点。 - 修:用户消息发送即上屏(不等模型/分类返回);regenerate_report 不再清空对话历史; 全屏 portal 到 body 工具栏恢复;解析兼容独立 edges 数组。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ed887f762e
commit
0890b3c375
7 files changed
+346
-62
No files matched your search
@@ -11,6 +11,41 @@ import { apiFetch } from "@/core/api/fetch-client";
|
||||
import { getBackendBaseURL } from "@/core/config";
|
||||
import type { FlowGraphData } from "@/roundtable-planning/lib/flow-graph";
|
||||
|
||||
/** 第三步输入框意图分类结果(与后端 /intent 对应)。 */
|
||||
export type FlowIntent = "regenerate_report" | "modify_flow" | "regenerate_flow" | "qa" | "unclear";
|
||||
|
||||
/**
|
||||
* 识别第三步输入框消息的意图(一次模型调用)。失败回退 "unclear"(前端发起澄清)。
|
||||
* 参考 ai_writing 的一次性 JSON 意图识别范式。
|
||||
*/
|
||||
export async function classifyFlowIntent(req: {
|
||||
message: string;
|
||||
hasReport: boolean;
|
||||
hasFlow: boolean;
|
||||
model?: string;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<{ intent: FlowIntent; reason: string }> {
|
||||
try {
|
||||
const res = await apiFetch(`${getBackendBaseURL()}/api/flow-extract/intent`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
message: req.message,
|
||||
has_report: req.hasReport,
|
||||
has_flow: req.hasFlow,
|
||||
model: req.model,
|
||||
}),
|
||||
signal: req.signal,
|
||||
});
|
||||
if (!res.ok) return { intent: "unclear", reason: "" };
|
||||
const data = (await res.json()) as { intent?: string; reason?: string };
|
||||
const intent = (data.intent ?? "unclear") as FlowIntent;
|
||||
return { intent, reason: data.reason ?? "" };
|
||||
} catch {
|
||||
return { intent: "unclear", reason: "" };
|
||||
}
|
||||
}
|
||||
|
||||
export interface FlowExtractRequest {
|
||||
/** 报告 Markdown(优先数据来源)。 */
|
||||
reportMd?: string | null;
|
||||
|
||||
Reference in new issue
Block a user