feat(roundtable): 第三步流程图后入库(示例技能 · 仅深链 taskId 模式)
- 流程图生成完成后,发起用户协助询问是否入库:现在 / 稍后 / 不入库。 - 仅**深链(taskId)模式**(会商 rwfx-A / 3qfx-A / xdfx-A 等)且入库技能启用时才出现入库 询问 / 协助卡 / 手动入库按钮;普通会商不受影响。 - 「稍后入库」后输入框自由文字做意图识别(后端 /api/flow-extract/ingest-intent: start_ingest / add_data / other / unclear),模糊则发起入库协助;另提供手动入库按钮。 - 入库执行复用总结智能体的同一线程,在消息列表出一条「知识库入库」气泡并显示步骤条 (调度 → 调用入库技能 →(补充内容)→ 提交 → 完成),与第二步同款。 - 入库数据以**用户最后修改后的流程图**为准;并把深链 **taskId 一并传给入库技能**(技能必需)。 - 入库状态(asking/later/done 等)随第三步草稿存取,重载不重复询问。 - 入库技能先用示例(演示用):skills/public/knowledge-base-ingest/SKILL.md(force-add, skills/ 目录默认 gitignore),后续替换为真实入库技能时沿用同名即无缝切换。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
b04b830039
commit
19028ba627
8 files changed
+458
-7
No files matched your search
@@ -173,6 +173,11 @@ export interface DraftStep3SummarySnapshot {
|
||||
dialogues?: unknown[];
|
||||
/** 各席位 write_file 调用重建的 stub(threadId → [stub ai message]),供加载后点开产物的虚拟预览。 */
|
||||
seatStubMessages?: Record<string, unknown[]>;
|
||||
/**
|
||||
* 入库状态(idle/asking/running/done/later/declined)。存它使重载草稿后不重复询问
|
||||
* 已入库/已选稍后的会商;恢复展示用。Optional —— 旧草稿无该字段。
|
||||
*/
|
||||
ingestStatus?: string;
|
||||
}
|
||||
|
||||
/** Lightweight metadata row returned by the list endpoint. */
|
||||
|
||||
@@ -46,6 +46,33 @@ export async function classifyFlowIntent(req: {
|
||||
}
|
||||
}
|
||||
|
||||
/** 「稍后入库」待命时输入框消息的入库意图(与后端 /ingest-intent 对应)。 */
|
||||
export type IngestIntent = "start_ingest" | "add_data" | "other" | "unclear";
|
||||
|
||||
/**
|
||||
* 识别「稍后入库」后用户在输入框的入库意图(一次模型调用)。
|
||||
* 失败回退 "unclear"(前端发起协助让用户自己选)。
|
||||
*/
|
||||
export async function classifyIngestIntent(req: {
|
||||
message: string;
|
||||
model?: string;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<{ intent: IngestIntent; reason: string }> {
|
||||
try {
|
||||
const res = await apiFetch(`${getBackendBaseURL()}/api/flow-extract/ingest-intent`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ message: req.message, model: req.model }),
|
||||
signal: req.signal,
|
||||
});
|
||||
if (!res.ok) return { intent: "unclear", reason: "" };
|
||||
const data = (await res.json()) as { intent?: string; reason?: string };
|
||||
return { intent: (data.intent ?? "unclear") as IngestIntent, reason: data.reason ?? "" };
|
||||
} catch {
|
||||
return { intent: "unclear", reason: "" };
|
||||
}
|
||||
}
|
||||
|
||||
export interface FlowExtractRequest {
|
||||
/** 报告 Markdown(优先数据来源)。 */
|
||||
reportMd?: string | null;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 第三步「入库」功能门控。
|
||||
*
|
||||
* 入库询问 / 意图识别 / 手动入库按钮只有在**入库技能存在且启用**时才出现
|
||||
* (对应需求「如果有了调用技能入库的技能后…」)。当前是示例技能 `knowledge-base-ingest`
|
||||
* (演示用);后续替换为真实入库技能时只要沿用同一个 name,本门控即继续生效。
|
||||
*/
|
||||
import { loadSkills } from "@/core/skills/api";
|
||||
|
||||
/** 入库技能名(示例/真实共用同一名字,方便无缝替换)。 */
|
||||
export const INGEST_SKILL_NAME = "knowledge-base-ingest";
|
||||
|
||||
/** 入库技能是否存在且启用。失败回退 false(不弹入库询问)。 */
|
||||
export async function isIngestSkillAvailable(): Promise<boolean> {
|
||||
try {
|
||||
const skills = await loadSkills();
|
||||
return skills.some((s) => s.name === INGEST_SKILL_NAME && s.enabled);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user