feat(roundtable): xdfx 行动名喂入 summary/抽取 + 第三步意图理解增强
- xdfx:把本次「行动名称」喂进 summary 材料(buildMaterials 加 actionName) 与结构化抽取 材料(flow_extract._material 加【本次行动】抬头),让报告/流程图都贴着该行动展开 - 第三步意图识别(classify_flow_intent)增强:新增 can_ingest 上下文 + ingest 意图;重写 _INTENT_SYS 走语义理解——「介绍/解释/为什么/总结一下」等对内容的提问→qa(文字答); 「帮我入库」(可入库时)→ingest→直接入库;能判断就给具体意图不轻易 unclear; 不可入库时误判 ingest 自动降级 qa。前端 classifyFlowIntent 传 canIngest,ask 新增 ingest 分支 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fba417918f
commit
ae2706dad3
3 files changed
+73
-21
No files matched your search
@@ -12,7 +12,7 @@ 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";
|
||||
export type FlowIntent = "regenerate_report" | "modify_flow" | "regenerate_flow" | "ingest" | "qa" | "unclear";
|
||||
|
||||
/**
|
||||
* 识别第三步输入框消息的意图(一次模型调用)。失败回退 "unclear"(前端发起澄清)。
|
||||
@@ -22,6 +22,8 @@ export async function classifyFlowIntent(req: {
|
||||
message: string;
|
||||
hasReport: boolean;
|
||||
hasFlow: boolean;
|
||||
/** 当前是否可入库(入库按钮已出现、未入库);为真才允许识别出 ingest 意图。 */
|
||||
canIngest?: boolean;
|
||||
model?: string;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<{ intent: FlowIntent; reason: string }> {
|
||||
@@ -33,6 +35,7 @@ export async function classifyFlowIntent(req: {
|
||||
message: req.message,
|
||||
has_report: req.hasReport,
|
||||
has_flow: req.hasFlow,
|
||||
can_ingest: req.canIngest ?? false,
|
||||
model: req.model,
|
||||
}),
|
||||
signal: req.signal,
|
||||
|
||||
@@ -180,10 +180,19 @@ function buildMaterials(opts: {
|
||||
seatDeliveries: ReportSeatDelivery[];
|
||||
consensusText: string;
|
||||
coordinatorPrompt?: string | null;
|
||||
/** xdfx:本次「行动名称」,作为材料抬头喂进总结(报告围绕该行动展开)。 */
|
||||
actionName?: string | null;
|
||||
}): string {
|
||||
const { intentReady, seatDeliveries, consensusText, coordinatorPrompt } = opts;
|
||||
const { intentReady, seatDeliveries, consensusText, coordinatorPrompt, actionName } = opts;
|
||||
const parts: string[] = [];
|
||||
|
||||
const an = actionName?.trim();
|
||||
if (an) {
|
||||
parts.push("# 本次行动");
|
||||
parts.push(an);
|
||||
parts.push("");
|
||||
}
|
||||
|
||||
const cp = coordinatorPrompt?.trim();
|
||||
if (cp) {
|
||||
parts.push("# 业务链总控编排提示(最高优先级,按它的关注点/结构/口径来组织报告)");
|
||||
@@ -295,6 +304,7 @@ function buildSummaryPrompt(opts: {
|
||||
seatDeliveries: ReportSeatDelivery[];
|
||||
consensusText: string;
|
||||
coordinatorPrompt?: string | null;
|
||||
actionName?: string | null;
|
||||
flowMode?: boolean;
|
||||
}): string {
|
||||
const parts: string[] = [];
|
||||
@@ -1262,6 +1272,9 @@ export function useStep3Summary(
|
||||
seatDeliveries,
|
||||
consensusText,
|
||||
coordinatorPrompt,
|
||||
// xdfx(7BF):把本次行动名称喂进总结材料,让报告围绕该行动展开。
|
||||
actionName:
|
||||
ingestBusinessCodeRef.current === "7BF" ? readActionDetail()?.actionName ?? null : null,
|
||||
flowMode,
|
||||
});
|
||||
await streamOnce({ bubbleId, prompt, aborter, flowRound: flowMode });
|
||||
@@ -1518,10 +1531,17 @@ export function useStep3Summary(
|
||||
if (!intent) {
|
||||
// **立刻**显示「智能体调度中」气泡(不等意图接口返回),消除连接卡顿时的"卡住"感。
|
||||
dispatchBubbleId = appendStreamingDialogue({ sender: "智能体", avatarType: "blue" });
|
||||
// 入库可用(按钮已出现、未入库 / 未在跑)时把 canIngest 传给意图识别——让「帮我入库」被识别为
|
||||
// ingest 而不是落到 qa/unclear(之前主分类器不懂入库,只有「稍后入库待命」时才识别入库,是个缺口)。
|
||||
const canIngestNow =
|
||||
ingestAvailableRef.current &&
|
||||
ingestStatusRef.current !== "running" &&
|
||||
ingestStatusRef.current !== "done";
|
||||
const r = await classifyFlowIntent({
|
||||
message: text,
|
||||
hasReport: !!currentMdRef.current.trim(),
|
||||
hasFlow: !!flowGraphRef.current,
|
||||
canIngest: canIngestNow,
|
||||
model: selectedModel || undefined,
|
||||
});
|
||||
intent = r.intent;
|
||||
@@ -1533,6 +1553,12 @@ export function useStep3Summary(
|
||||
setPendingFlowClarification(text); // 组件渲染选项让用户自己定
|
||||
return;
|
||||
}
|
||||
if (intent === "ingest") {
|
||||
// 识别为入库(后端已保证仅 can_ingest 时才会返回 ingest)→ 直接入库;复用调度气泡。
|
||||
if (dispatchBubbleId != null) finalizeDialogue(dispatchBubbleId, "正在入库…", "入库中");
|
||||
await runIngest();
|
||||
return;
|
||||
}
|
||||
if (intent === "regenerate_flow" || intent === "modify_flow") {
|
||||
const flowAborter = new AbortController();
|
||||
aborterRef.current = flowAborter;
|
||||
|
||||
Reference in new issue
Block a user