Step3 总结报告与顶栏主题背景图

新增 roundtable-summary 智能体及前后端 Step3 Markdown 总结流程;顶栏在浅/深主题下分别使用红/深蓝横幅背景。
This commit is contained in:
fengxiangdebaozi committed 2026-06-11 21:51:59 +08:00
1 parent 10047de745
commit 2d74f8883e
14 files changed
+2060 -18

No files matched your search

@@ -103,14 +103,44 @@ export interface DraftStep2RunSnapshot {
* thread. Optional — drafts saved before this feature (or never drawn) won't carry it.
*/
export interface DraftStep3Snapshot {
/** The full self-contained HTML written to outputs/方案总览.html. */
html: string;
/** ISO timestamp when the report was generated. */
generatedAt: string;
/** The inference model used to draw it. */
model: string;
/** The agent's closing one-liner (rendered as the report message bubble). */
/**
* The full self-contained HTML written to outputs/方案总览.html by the
* `roundtable-report` (HTML 看板) agent. Optional — a draft may only carry the
* Markdown 总结报告 (`summaryReport`) and never draw the HTML 看板.
*/
html?: string;
/** ISO timestamp when the HTML report was generated. */
generatedAt?: string;
/** The inference model used to draw the HTML report. */
model?: string;
/** The HTML agent's closing one-liner (rendered as the report message bubble). */
summary?: string;
/**
* Step 3「总结报告」snapshot — output of the `roundtable-summary` agent
* (Markdown report). Stored alongside (not instead of) the HTML report so the
* two Step-3 surfaces persist independently. Nested in the free-form step3 JSON
* blob, so the backend needs no schema change. Optional.
*/
summaryReport?: DraftStep3SummarySnapshot | null;
}
/**
* Step 3「总结报告」snapshot — the Markdown report written by `roundtable-summary`,
* stored inline so a reloaded draft can show it without depending on the ephemeral
* summary thread. `threadId` keeps the real summary thread id so a reloaded draft
* can continue Q&A / refinement on the same thread (the agent keeps its context).
*/
export interface DraftStep3SummarySnapshot {
/** The full Markdown written to outputs/方案总结报告.md. */
md: string;
/** The real summary thread id — reused for follow-up Q&A / refine after reload. */
threadId?: string;
/** ISO timestamp when the summary was generated. */
generatedAt: string;
/** The inference model used to write it. */
model: string;
/** The agent's closing chat text (the report body it echoed into the conversation). */
closing?: string;
}
/** Lightweight metadata row returned by the list endpoint. */
@@ -818,3 +818,28 @@ export async function initReportThread(
const json = (await res.json()) as { agent_name: string; thread_id: string };
return { agentName: json.agent_name, threadId: json.thread_id };
}
/**
* Create a thread for the Step 3「总结报告」summary agent (`roundtable-summary`,
* a built-in singleton — distinct from `roundtable-report`; this only spins up a
* cheap thread, it never re-creates the agent). Run it afterwards with
* {@link streamMultiAgent} (`agentType: "special"`, `agentName: "roundtable-summary"`,
* `dAgentThreadId: { [agentName]: threadId }`). Follow-up Q&A / refinements reuse
* the SAME thread (do not re-init) so the agent keeps the report context.
*/
export async function initSummaryThread(
options: { signal?: AbortSignal } = {},
): Promise<ReportThreadResponse> {
const res = await apiFetch(`${getBackendBaseURL()}/api/multi-agent/summary/init`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: "{}",
signal: options.signal,
});
if (!res.ok) {
const text = await res.text().catch(() => "");
throw new Error(`init summary thread failed (${res.status}): ${text}`);
}
const json = (await res.json()) as { agent_name: string; thread_id: string };
return { agentName: json.agent_name, threadId: json.thread_id };
}