From dce882ca914c3b59f51bd930a788fde06bab8c02 Mon Sep 17 00:00:00 2001 From: Yaojia Wang Date: Thu, 9 Jul 2026 17:00:14 +0200 Subject: [PATCH] =?UTF-8?q?chore(frontend):=20pnpm=20gen:api=20=E7=BA=B3?= =?UTF-8?q?=E5=85=A5=20AI=20=E5=AF=B9=E8=AF=9D=E7=AB=AF=E7=82=B9=EF=BC=88A?= =?UTF-8?q?C-3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit POST/GET /projects/{id}/ai-messages + AiMessageAppendRequest/AiMessageInput/ AiMessageView/AiMessageListResponse 由后端 OpenAPI 重生成进 schema.d.ts。 --- apps/web/lib/api/schema.d.ts | 228 +++++++++++++++++++++++++++++++++-- 1 file changed, 221 insertions(+), 7 deletions(-) diff --git a/apps/web/lib/api/schema.d.ts b/apps/web/lib/api/schema.d.ts index da869d7..debec93 100644 --- a/apps/web/lib/api/schema.d.ts +++ b/apps/web/lib/api/schema.d.ts @@ -62,7 +62,10 @@ export interface paths { path?: never; cookie?: never; }; - /** List Projects */ + /** + * List Projects + * @description 作品列表(按 created_at 升序,分页)。`?limit=&offset=`,默认第一页。 + */ get: operations["list_projects_projects_get"]; put?: never; /** Create Project */ @@ -494,7 +497,7 @@ export interface paths { }; /** * List Templates - * @description 列出当前用户(stub)的模板。 + * @description 列出当前用户(stub)的模板(分页;`?limit=&offset=`,默认第一页)。 */ get: operations["list_templates_templates_get"]; put?: never; @@ -529,6 +532,30 @@ export interface paths { patch?: never; trace?: never; }; + "/projects/{project_id}/ai-messages": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** + * List Ai Messages + * @description 列出 AI 对话(newest-first)。`chapter_no` → 本章 ∪ 项目级(NULL);缺省 → 仅项目级。 + */ + get: operations["list_ai_messages_projects__project_id__ai_messages_get"]; + put?: never; + /** + * Append Ai Messages + * @description 一批往复 bubble append(201)。项目不存在 → 404;非法 kind/role/空/超上限 → 422。 + */ + post: operations["append_ai_messages_projects__project_id__ai_messages_post"]; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/projects/{project_id}/world/generate": { parameters: { query?: never; @@ -924,6 +951,95 @@ export interface components { */ review_id?: string | null; }; + /** + * AiMessageAppendRequest + * @description POST /projects/{id}/ai-messages:一次交换的一批 bubble(批级字段提顶层)。 + */ + AiMessageAppendRequest: { + /** + * Thread Id + * Format: uuid + */ + thread_id: string; + /** Chapter No */ + chapter_no?: number | null; + /** + * Kind + * @enum {string} + */ + kind: "refine" | "rewrite" | "clarify" | "continue" | "generator"; + /** Tool Key */ + tool_key?: string | null; + /** Messages */ + messages: components["schemas"]["AiMessageInput"][]; + }; + /** + * AiMessageInput + * @description 一条待落库 bubble(角色 + 人读文本 + 结构化 meta)。 + */ + AiMessageInput: { + /** + * Role + * @enum {string} + */ + role: "author" | "ai"; + /** Content */ + content: string; + /** Meta */ + meta?: { + [key: string]: unknown; + }; + }; + /** + * AiMessageListResponse + * @description append/list 信封:`messages` 复数键(repo 约定,非 `items`)。 + */ + AiMessageListResponse: { + /** Messages */ + messages: components["schemas"]["AiMessageView"][]; + }; + /** + * AiMessageView + * @description 聊天留痕视图(append/list 回显;snake_case,镜像 repo view)。 + */ + AiMessageView: { + /** + * Id + * Format: uuid + */ + id: string; + /** + * Project Id + * Format: uuid + */ + project_id: string; + /** Chapter No */ + chapter_no: number | null; + /** + * Thread Id + * Format: uuid + */ + thread_id: string; + /** Seq */ + seq: number; + /** Kind */ + kind: string; + /** Tool Key */ + tool_key: string | null; + /** Role */ + role: string; + /** Content */ + content: string; + /** Meta */ + meta?: { + [key: string]: unknown; + }; + /** + * Created At + * Format: date-time + */ + created_at: string; + }; /** * CapabilitiesView * @description 探测得到的能力矩阵(镜像网关 `Capabilities`)。 @@ -2638,7 +2754,10 @@ export interface operations { }; list_projects_projects_get: { parameters: { - query?: never; + query?: { + limit?: number; + offset?: number; + }; header?: never; path?: never; cookie?: never; @@ -2654,6 +2773,15 @@ export interface operations { "application/json": components["schemas"]["ProjectListResponse"]; }; }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; }; }; create_project_projects_post: { @@ -2908,13 +3036,14 @@ export interface operations { }; }; responses: { - /** @description Successful Response */ + /** @description SSE 事件流(`event: \ndata: `,见 memory/contracts.md) */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": unknown; + "text/event-stream": unknown; }; }; /** @description Validation Error */ @@ -2944,13 +3073,14 @@ export interface operations { }; }; responses: { - /** @description Successful Response */ + /** @description SSE 事件流(`event: \ndata: `,见 memory/contracts.md) */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": unknown; + "text/event-stream": unknown; }; }; /** @description Validation Error */ @@ -3034,13 +3164,14 @@ export interface operations { }; }; responses: { - /** @description Successful Response */ + /** @description SSE 事件流(`event: \ndata: `,见 memory/contracts.md) */ 200: { headers: { [name: string]: unknown; }; content: { "application/json": unknown; + "text/event-stream": unknown; }; }; /** @description Validation Error */ @@ -3584,7 +3715,10 @@ export interface operations { }; list_templates_templates_get: { parameters: { - query?: never; + query?: { + limit?: number; + offset?: number; + }; header?: never; path?: never; cookie?: never; @@ -3600,6 +3734,15 @@ export interface operations { "application/json": components["schemas"]["TemplateResponse"][]; }; }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; }; }; create_template_templates_post: { @@ -3664,6 +3807,77 @@ export interface operations { }; }; }; + list_ai_messages_projects__project_id__ai_messages_get: { + parameters: { + query?: { + chapter_no?: number | null; + kind?: ("refine" | "rewrite" | "clarify" | "continue" | "generator") | null; + limit?: number; + offset?: number; + }; + header?: never; + path: { + project_id: string; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successful Response */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["AiMessageListResponse"]; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; + append_ai_messages_projects__project_id__ai_messages_post: { + parameters: { + query?: never; + header?: never; + path: { + project_id: string; + }; + cookie?: never; + }; + requestBody: { + content: { + "application/json": components["schemas"]["AiMessageAppendRequest"]; + }; + }; + responses: { + /** @description Successful Response */ + 201: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["AiMessageListResponse"]; + }; + }; + /** @description Validation Error */ + 422: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["HTTPValidationError"]; + }; + }; + }; + }; generate_world_projects__project_id__world_generate_post: { parameters: { query?: never;