修复 embed 跨域并持久化圆桌 Step3 结果

- Gateway 默认 CORS 白名单增加 5174,embed 文档补充跨域配置说明
- 圆桌草稿新增 step3 快照字段与迁移,结果绘制 HTML 可随草稿恢复

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
董宏凯andCursor committed 2026-06-03 16:27:42 +08:00
1 parent 40ba81ee6a
commit aea7724cdb
15 files changed
+527 -89

No files matched your search

@@ -56,6 +56,22 @@ export interface DraftStep2Snapshot {
chain?: { id: string; title: string } | null;
}
/**
* Step 3「结果绘制」snapshot — the generated visualization report, stored inline
* so a reloaded draft can show it without depending on the ephemeral report
* 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). */
summary?: string;
}
/** Lightweight metadata row returned by the list endpoint. */
export interface DraftMeta {
id: string;
@@ -70,6 +86,7 @@ export interface DraftMeta {
export interface DraftRecord extends DraftMeta {
step1: DraftStep1Snapshot | null;
step2: DraftStep2Snapshot | null;
step3: DraftStep3Snapshot | null;
}
/** Fields accepted when creating a draft. */
@@ -80,6 +97,7 @@ export interface DraftCreatePayload {
furthestStep: 1 | 2 | 3;
step1: DraftStep1Snapshot;
step2: DraftStep2Snapshot;
step3?: DraftStep3Snapshot | null;
}
/** Partial update — send only what changed. Omitting `title` preserves a rename. */
@@ -88,6 +106,7 @@ export interface DraftUpdatePayload {
furthestStep?: 1 | 2 | 3;
step1?: DraftStep1Snapshot;
step2?: DraftStep2Snapshot;
step3?: DraftStep3Snapshot | null;
}
const BASE = () => `${getBackendBaseURL()}/api/roundtable-drafts`;
@@ -115,6 +134,7 @@ interface ServerDraftMeta {
interface ServerDraftFull extends ServerDraftMeta {
step1: DraftStep1Snapshot | null;
step2: DraftStep2Snapshot | null;
step3: DraftStep3Snapshot | null;
}
function toMeta(s: ServerDraftMeta): DraftMeta {
@@ -129,7 +149,12 @@ function toMeta(s: ServerDraftMeta): DraftMeta {
}
function toRecord(s: ServerDraftFull): DraftRecord {
return { ...toMeta(s), step1: s.step1 ?? null, step2: s.step2 ?? null };
return {
...toMeta(s),
step1: s.step1 ?? null,
step2: s.step2 ?? null,
step3: s.step3 ?? null,
};
}
function fromCreate(p: DraftCreatePayload) {
@@ -139,6 +164,7 @@ function fromCreate(p: DraftCreatePayload) {
furthest_step: p.furthestStep,
step1: p.step1,
step2: p.step2,
...(p.step3 !== undefined ? { step3: p.step3 } : {}),
};
}
@@ -148,6 +174,7 @@ function fromUpdate(p: DraftUpdatePayload) {
if (p.furthestStep !== undefined) out.furthest_step = p.furthestStep;
if (p.step1 !== undefined) out.step1 = p.step1;
if (p.step2 !== undefined) out.step2 = p.step2;
if (p.step3 !== undefined) out.step3 = p.step3;
return out;
}