feat(frontend): 上线报告协作与多轮 RAG 消息聚合体验

功能说明:\n- 新增报告协作页(Report Collaboration)核心状态层、消息适配与会话面板,支持按节点/阶段选择和协作上下文展示\n- 补齐 report-collaboration API 与类型定义,并接入页面路由/构建路径,形成可运行的协作链路\n- 重构多轮 RAG 与 write/artefact 消息分组逻辑,优化 AgentChat 与 DeepResearch 场景下的消息展示顺序与可读性\n- 新增/更新 DeepResearch 前端页面(Workbench、报告配置、沙箱联动)以承接报告生成与复用能力\n- 增加报表协作相关单测,覆盖事件归并、消息适配与关键 reducer 行为
This commit is contained in:
董宏凯 committed 2026-09-04 23:18:27 +08:00
1 parent e58da3fbdf
commit 438772f0b7
25 files changed
+1740 -399

No files matched your search

@@ -111,6 +111,28 @@ test("a lone deep-research progress bar still opens its own group", () => {
assert.deepEqual(types, ["assistant:processing"]);
});
test("multi-round RAG assistant rows render even while the final answer is still empty", () => {
const types = groupTypes([
{ type: "human", id: "h1", content: "检索一下", additional_kwargs: { multi_round_rag: true } } as Message,
{
type: "ai",
id: "a1",
content: "",
additional_kwargs: {
multi_round_rag: true,
multi_round_rag_trace: {
title: "多轮检索思考过程",
rounds: [{ id: "r1", title: "思考过程", thoughtMarkdown: "正在拆解问题", query: "", queryShow: true, retrievals: [] }],
finalAnswerMarkdown: "",
thinkingComplete: false,
},
},
} as Message,
]);
assert.deepEqual(types, ["human", "assistant"]);
});
test("tool messages still attach to an open processing group", () => {
const types = groupTypes([
{
+10
View File
@@ -141,6 +141,16 @@ export function groupMessages<T>(
}
if (message.type === "ai") {
// Multi-round RAG keeps rounds/retrievals on additional_kwargs while the
// visible answer is still empty. The default rule below only opens an
// assistant bubble when hasContent() is true, which would swallow the
// live thinking cards until the final answer arrives (or forever, if the
// turn is think/search-only). Force a normal assistant row so
// MessageListItem can render MultiRoundRagAssistantBody immediately.
if (message.additional_kwargs?.multi_round_rag === true) {
groups.push({ id: message.id, type: "assistant", messages: [message] });
continue;
}
// Deep-research interaction card: virtual ai messages injected by the
// workbench (additional_kwargs.setup_research_approval) render through
// the host-provided slot. Writing phases use ordinary virtual tool calls
@@ -144,20 +144,22 @@ function platformTypeChange(platform: string) {
return platform || "facebook";
}
function createEmptyRound(title: string, thoughtMarkdown = ""): MultiRoundRagRound {
return {
id: createId("multi-rag-round"),
title,
thoughtMarkdown,
query: "",
queryLoading: false,
queryShow: false,
retrievals: [],
};
}
function createEmptyTrace(): MultiRoundRagTrace {
return {
title: "多轮检索思考过程",
rounds: [
{
id: createId("multi-rag-round"),
title: "正在准备检索",
thoughtMarkdown: "",
query: "",
queryLoading: true,
queryShow: true,
retrievals: [],
},
],
rounds: [createEmptyRound("正在准备检索")],
thinkingComplete: false,
finalAnswerMarkdown: "",
};
@@ -370,16 +372,8 @@ export function applyMultiRoundToolCall(trace: MultiRoundRagTrace, toolValue: un
round.thoughtMarkdown = mergeThink(round.thoughtMarkdown, thinkContent);
} else {
round.queryLoading = false;
round.queryShow = round.retrievals.length > 0;
trace.rounds.push({
id: createId("multi-rag-round"),
title: "思考中",
thoughtMarkdown: thinkContent,
query: "",
queryLoading: true,
queryShow: true,
retrievals: [],
});
round.queryShow = Boolean(round.query) || round.retrievals.length > 0;
trace.rounds.push(createEmptyRound("思考中", thinkContent));
}
} else {
round.queryLoading = false;