@waterwx/dsh-novel-forge 1.1.8 → 1.2.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +231 -349
- package/lib/client.js +54833 -9926
- package/lib/index.js +12137 -4734
- package/lib/types/action-guard.d.ts +61 -0
- package/lib/types/ai-scan.d.ts +36 -0
- package/lib/types/assets.d.ts +18 -3
- package/lib/types/assistant.d.ts +29 -0
- package/lib/types/author-assets.d.ts +25 -0
- package/lib/types/bookshelf.d.ts +11 -1
- package/lib/types/client/api.d.ts +153 -9
- package/lib/types/client/docx.d.ts +2 -0
- package/lib/types/client/index.d.ts +1 -1
- package/lib/types/client/llmLive.d.ts +33 -0
- package/lib/types/client/locales.d.ts +34 -9
- package/lib/types/client/panel/AdaptModeView.d.ts +5 -0
- package/lib/types/client/panel/AiTag.d.ts +1 -0
- package/lib/types/client/panel/AssistantTab.d.ts +4 -1
- package/lib/types/client/panel/AuthorAssetsView.d.ts +4 -0
- package/lib/types/client/panel/AuthorHome.d.ts +34 -0
- package/lib/types/client/panel/BookAnalysisView.d.ts +4 -0
- package/lib/types/client/panel/CmdPalette.d.ts +12 -0
- package/lib/types/client/panel/CreateBookView.d.ts +5 -1
- package/lib/types/client/panel/DirectorView.d.ts +7 -0
- package/lib/types/client/panel/GlobalAssetLibraryView.d.ts +4 -0
- package/lib/types/client/panel/IdeaInspirationView.d.ts +6 -0
- package/lib/types/client/panel/ImportModal.d.ts +7 -0
- package/lib/types/client/panel/KnowledgeBaseView.d.ts +4 -0
- package/lib/types/client/panel/LiveFeedLog.d.ts +8 -0
- package/lib/types/client/panel/MarketRadarView.d.ts +5 -0
- package/lib/types/client/panel/ModelManager.d.ts +14 -0
- package/lib/types/client/panel/NovelPanel.d.ts +6 -1
- package/lib/types/client/panel/PageHeader.d.ts +18 -0
- package/lib/types/client/panel/ProgressConsole.d.ts +17 -0
- package/lib/types/client/panel/ProgressHomeView.d.ts +5 -0
- package/lib/types/client/panel/ReasoningSection.d.ts +10 -0
- package/lib/types/client/panel/RunPanel.d.ts +5 -0
- package/lib/types/client/panel/SettingsView.d.ts +19 -0
- package/lib/types/client/panel/ShelfView.d.ts +12 -1
- package/lib/types/client/panel/SubPage.d.ts +27 -0
- package/lib/types/client/panel/toast.d.ts +2 -0
- package/lib/types/client/panel/views.d.ts +25 -7
- package/lib/types/client/run-status.d.ts +19 -0
- package/lib/types/client/text.d.ts +9 -0
- package/lib/types/docx-core.d.ts +16 -0
- package/lib/types/docx.d.ts +2 -3
- package/lib/types/engine.d.ts +152 -40
- package/lib/types/global-assets.d.ts +6 -0
- package/lib/types/index.d.ts +20 -2
- package/lib/types/llm-live.d.ts +44 -0
- package/lib/types/market-radar-scan.d.ts +19 -0
- package/lib/types/market-radar-sources.d.ts +31 -0
- package/lib/types/migrate-output.d.ts +25 -0
- package/lib/types/novel-context.d.ts +80 -0
- package/lib/types/prompt-utils.d.ts +35 -0
- package/lib/types/prompting.d.ts +10 -0
- package/lib/types/protocol.d.ts +1106 -123
- package/lib/types/review-policy.d.ts +97 -0
- package/lib/types/routes.d.ts +4 -0
- package/lib/types/run.d.ts +34 -0
- package/lib/types/stage-contract.d.ts +60 -0
- package/package.json +52 -27
- package/scripts/patch-schemastery.mjs +47 -0
- package/src/action-guard.ts +127 -0
- package/src/ai-scan.ts +179 -0
- package/src/assets.ts +1774 -520
- package/src/assistant.ts +1082 -770
- package/src/author-assets.ts +149 -0
- package/src/bookshelf.ts +187 -151
- package/src/client/api.ts +684 -387
- package/src/client/docx.ts +37 -69
- package/src/client/index.ts +3 -1
- package/src/client/llmLive.ts +101 -0
- package/src/client/locales.ts +418 -367
- package/src/client/mount.tsx +1 -1
- package/src/client/panel/AdaptModeView.tsx +535 -0
- package/src/client/panel/AiTag.tsx +7 -0
- package/src/client/panel/AssetsTab.tsx +448 -439
- package/src/client/panel/AssistantTab.tsx +355 -301
- package/src/client/panel/AuthorAssetsView.tsx +206 -0
- package/src/client/panel/AuthorHome.tsx +309 -0
- package/src/client/panel/BookAnalysisView.tsx +63 -0
- package/src/client/panel/CmdPalette.tsx +102 -0
- package/src/client/panel/CreateBookView.tsx +366 -348
- package/src/client/panel/DirectorView.tsx +200 -0
- package/src/client/panel/GlobalAssetLibraryView.tsx +168 -0
- package/src/client/panel/IdeaInspirationView.tsx +76 -0
- package/src/client/panel/ImportModal.tsx +303 -0
- package/src/client/panel/KnowledgeBaseView.tsx +125 -0
- package/src/client/panel/LiveFeedLog.tsx +67 -0
- package/src/client/panel/MarketRadarView.tsx +377 -0
- package/src/client/panel/ModelManager.tsx +205 -0
- package/src/client/panel/NovelPanel.tsx +5403 -4294
- package/src/client/panel/PageHeader.tsx +37 -0
- package/src/client/panel/ProgressConsole.tsx +63 -0
- package/src/client/panel/ReaderView.tsx +306 -306
- package/src/client/panel/ReasoningSection.tsx +31 -0
- package/src/client/panel/RunPanel.tsx +223 -0
- package/src/client/panel/SettingsView.tsx +305 -0
- package/src/client/panel/ShelfView.tsx +266 -235
- package/src/client/panel/SubPage.tsx +42 -0
- package/src/client/panel/WorldTab.tsx +202 -202
- package/src/client/panel/panel.module.css +5764 -2817
- package/src/client/panel/toast.ts +51 -0
- package/src/client/panel/views.tsx +401 -314
- package/src/client/run-status.ts +143 -0
- package/src/client/sidebar-entry.ts +1 -1
- package/src/client/text.ts +28 -0
- package/src/docx-core.ts +53 -0
- package/src/docx.ts +44 -83
- package/src/engine.ts +4231 -2746
- package/src/global-assets.ts +59 -0
- package/src/index.ts +311 -246
- package/src/llm-live.ts +68 -0
- package/src/market-radar-scan.ts +41 -0
- package/src/market-radar-sources.ts +173 -0
- package/src/migrate-output.ts +76 -0
- package/src/novel-context.ts +286 -0
- package/src/prompting.ts +26 -0
- package/src/protocol.ts +2072 -1104
- package/src/review-policy.ts +161 -0
- package/src/routes.ts +3405 -2050
- package/src/run.ts +342 -0
- package/src/stage-contract.ts +189 -0
- package/lib/client.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/src/client/panel/BookshelfBar.tsx +0 -170
package/lib/types/protocol.d.ts
CHANGED
|
@@ -14,6 +14,20 @@ export declare const NOVEL_API: {
|
|
|
14
14
|
readonly bible: "/api/dsh-novel-forge/bible";
|
|
15
15
|
readonly assets: "/api/dsh-novel-forge/assets";
|
|
16
16
|
readonly styleEngine: "/api/dsh-novel-forge/style-engine";
|
|
17
|
+
readonly styleFormula: "/api/dsh-novel-forge/style-formula";
|
|
18
|
+
readonly styleDetect: "/api/dsh-novel-forge/style-detect";
|
|
19
|
+
readonly knowledge: "/api/dsh-novel-forge/knowledge";
|
|
20
|
+
readonly bookAnalysis: "/api/dsh-novel-forge/book-analysis";
|
|
21
|
+
readonly ideaInspiration: "/api/dsh-novel-forge/idea-inspiration";
|
|
22
|
+
readonly ideaInspirationMarket: "/api/dsh-novel-forge/idea-inspiration/market";
|
|
23
|
+
readonly director: "/api/dsh-novel-forge/director";
|
|
24
|
+
readonly directorTodos: "/api/dsh-novel-forge/director/todos";
|
|
25
|
+
readonly llmLive: "/api/dsh-novel-forge/llm-live/stream";
|
|
26
|
+
readonly marketRadar: "/api/dsh-novel-forge/market-radar";
|
|
27
|
+
readonly marketRadarScan: "/api/dsh-novel-forge/market-radar/scan";
|
|
28
|
+
readonly marketRadarApply: "/api/dsh-novel-forge/market-radar/apply";
|
|
29
|
+
readonly marketRadarSync: "/api/dsh-novel-forge/market-radar/foundation-sync";
|
|
30
|
+
readonly marketRadarBrief: "/api/dsh-novel-forge/market-radar/brief";
|
|
17
31
|
readonly generate: "/api/dsh-novel-forge/generate";
|
|
18
32
|
readonly review: "/api/dsh-novel-forge/review";
|
|
19
33
|
readonly rewrite: "/api/dsh-novel-forge/rewrite";
|
|
@@ -35,6 +49,24 @@ export declare const NOVEL_API: {
|
|
|
35
49
|
/** 清空助手对话记录。 */
|
|
36
50
|
readonly assistantClear: "/api/dsh-novel-forge/assistant/clear";
|
|
37
51
|
readonly bookshelf: "/api/dsh-novel-forge/bookshelf";
|
|
52
|
+
/** 导入已有项目目录(含 novel-project.json)到书架。 */
|
|
53
|
+
readonly bookshelfImportDir: "/api/dsh-novel-forge/bookshelf/import-dir";
|
|
54
|
+
/** 导入 txt/md 全本:拆章建项目并登记书架。 */
|
|
55
|
+
readonly bookshelfImportText: "/api/dsh-novel-forge/bookshelf/import-text";
|
|
56
|
+
/** 导入 txt/md 全本:拆章预览(不落盘)。 */
|
|
57
|
+
readonly bookshelfImportTextPreview: "/api/dsh-novel-forge/bookshelf/import-text/preview";
|
|
58
|
+
/** LLM 模型连通性测试:真实最小调用,验证 Key / 端点 / 模型可用。 */
|
|
59
|
+
readonly llmTest: "/api/dsh-novel-forge/llm-test";
|
|
60
|
+
/** 添加模型:厂商直填 key 或自定义路由,写进 DSH 凭据与 llm-pi-ai 路由。 */
|
|
61
|
+
readonly addModel: "/api/dsh-novel-forge/llm-add";
|
|
62
|
+
/** 运行时厂商目录(DSH pi-ai 可配置提供方 + 内置适配器)。 */
|
|
63
|
+
readonly llmVendors: "/api/dsh-novel-forge/llm-vendors";
|
|
64
|
+
/** 查询某个 provider 当前可用的模型(添加成功后可即时刷新)。 */
|
|
65
|
+
readonly llmModels: "/api/dsh-novel-forge/llm-models";
|
|
66
|
+
/** 已注册的提供方路由列表(提供方管理)。 */
|
|
67
|
+
readonly llmProviders: "/api/dsh-novel-forge/llm-providers";
|
|
68
|
+
/** 移除一个提供方。 */
|
|
69
|
+
readonly llmRemove: "/api/dsh-novel-forge/llm-remove";
|
|
38
70
|
/** 重置项目(可选携带新大纲):清空设定/卷/章节/伏笔/资产/事实库。 */
|
|
39
71
|
readonly reset: "/api/dsh-novel-forge/reset";
|
|
40
72
|
/** 全书一致性质检:LLM 扫描已生成章节,输出矛盾问题清单。 */
|
|
@@ -43,19 +75,19 @@ export declare const NOVEL_API: {
|
|
|
43
75
|
readonly charactersRefresh: "/api/dsh-novel-forge/characters/refresh";
|
|
44
76
|
/** 事实库回填:对历史已生成章节批量抽取事实(旧章节无事实记录时用)。 */
|
|
45
77
|
readonly factsBackfill: "/api/dsh-novel-forge/facts/backfill";
|
|
46
|
-
/**
|
|
78
|
+
/** 道藏局部修补(如世界观规则编辑)。 */
|
|
47
79
|
readonly biblePatch: "/api/dsh-novel-forge/bible/patch";
|
|
48
80
|
/** 小说简介:生成(AI)/补全(AI)/保存。 */
|
|
49
81
|
readonly blurb: "/api/dsh-novel-forge/blurb";
|
|
50
82
|
/** 重命名当前书(同步项目与书架条目)。 */
|
|
51
83
|
readonly rename: "/api/dsh-novel-forge/rename";
|
|
52
|
-
/**
|
|
84
|
+
/** 大世界:提炼 / 保存结构化数据(境界/区域/势力)。 */
|
|
53
85
|
readonly world: "/api/dsh-novel-forge/world";
|
|
54
86
|
/** 封面:GET 读取(dataUrl)/ POST 上传或移除。 */
|
|
55
87
|
readonly cover: "/api/dsh-novel-forge/blurb/cover";
|
|
56
88
|
/** 剧情线管理:增删改 + 关联章节。 */
|
|
57
89
|
readonly plotlines: "/api/dsh-novel-forge/plotlines";
|
|
58
|
-
/**
|
|
90
|
+
/** 角色库:提炼 / 采纳 / 更新 / 删除。 */
|
|
59
91
|
readonly roles: "/api/dsh-novel-forge/roles";
|
|
60
92
|
/** 作者复盘补跑:对已写章节补齐 authorReview(全书流式 / 单章 JSON)。 */
|
|
61
93
|
readonly reviewBackfill: "/api/dsh-novel-forge/review/backfill";
|
|
@@ -65,16 +97,52 @@ export declare const NOVEL_API: {
|
|
|
65
97
|
readonly chapterApprove: "/api/dsh-novel-forge/chapter/approve";
|
|
66
98
|
/** 敏感词检查:全书已写章节或指定文本。 */
|
|
67
99
|
readonly sensitiveCheck: "/api/dsh-novel-forge/sensitive-check";
|
|
68
|
-
/** 开书想法 →
|
|
100
|
+
/** 开书想法 → 补全大纲:输入一句话想法,生成 2-3 个可选大纲方案。 */
|
|
69
101
|
readonly outlineSuggest: "/api/dsh-novel-forge/outline/suggest";
|
|
102
|
+
/** 反推大纲:从已写章节正文反向生成全书总纲(NDJSON 流)。 */
|
|
103
|
+
readonly outlineReverse: "/api/dsh-novel-forge/outline/reverse";
|
|
70
104
|
/** 拆书分析:对已写章节做结构/人物/文风/卖点四维体检(两阶段:源笔记→分节分析)。 */
|
|
71
105
|
readonly breakdown: "/api/dsh-novel-forge/breakdown";
|
|
72
|
-
/**
|
|
73
|
-
readonly
|
|
74
|
-
/**
|
|
75
|
-
readonly
|
|
106
|
+
/** 生产单:启动批量生产(计划补足 + 逐章生成 + 被拒分级处理)。 */
|
|
107
|
+
readonly runStart: "/api/dsh-novel-forge/run/start";
|
|
108
|
+
/** 生产单控制:pause / resume / stop。 */
|
|
109
|
+
readonly runControl: "/api/dsh-novel-forge/run/control";
|
|
110
|
+
/** 生产单状态(含进度统计与日志)。 */
|
|
111
|
+
readonly runStatus: "/api/dsh-novel-forge/run/status";
|
|
76
112
|
readonly config: "/api/dsh-novel-forge/config";
|
|
113
|
+
/** 输出目录迁移:dryRun 预览 / 确认后搬文件并联动配置与书架。 */
|
|
114
|
+
readonly moveOutputDir: "/api/dsh-novel-forge/move-output-dir";
|
|
115
|
+
/** 本书参数:POST {} 读取;POST {patch} 合并保存(存 novel-project.json)。 */
|
|
116
|
+
readonly bookSettings: "/api/dsh-novel-forge/book-settings";
|
|
77
117
|
readonly openFolder: "/api/dsh-novel-forge/open-folder";
|
|
118
|
+
/** 插件自更新:在 DSH profile 目录拉取最新 npm 版(下载后需重启 DSH 生效)。 */
|
|
119
|
+
readonly pluginUpdate: "/api/dsh-novel-forge/plugin/update";
|
|
120
|
+
/** 作者资产库/总数据:读取个人跨书资产(笔法/红线/套路/角色模板/世界观模板)。 */
|
|
121
|
+
readonly authorAssets: "/api/dsh-novel-forge/author-assets";
|
|
122
|
+
/** 作者资产库:新增/更新一条资产(upsert by id)。 */
|
|
123
|
+
readonly authorAssetsUpsert: "/api/dsh-novel-forge/author-assets/upsert";
|
|
124
|
+
/** 作者资产库:删除一条资产。 */
|
|
125
|
+
readonly authorAssetsRemove: "/api/dsh-novel-forge/author-assets/remove";
|
|
126
|
+
/** 作者资产库:导入默认(书架书的写作资产/角色 + 内置全局库)批量沉淀。 */
|
|
127
|
+
readonly authorAssetsImportDefault: "/api/dsh-novel-forge/author-assets/import-default";
|
|
128
|
+
/** 改编模式:上传全文 → 分析 → 原文设定卡片/可改范围矩阵。 */
|
|
129
|
+
readonly adaptAnalyze: "/api/dsh-novel-forge/adapt/analyze";
|
|
130
|
+
/** 改编模式:确认要改的维度 → 生成映射表/改编规则/联动影响清单。 */
|
|
131
|
+
readonly adaptPropose: "/api/dsh-novel-forge/adapt/propose";
|
|
132
|
+
/** 改编模式:执行术语替换(全局替换 + 命中统计 + 改编文本预览)。 */
|
|
133
|
+
readonly adaptExecute: "/api/dsh-novel-forge/adapt/execute";
|
|
134
|
+
/** 改编模式:保存改编全文为新书(原书保留,登记书架)。 */
|
|
135
|
+
readonly adaptSave: "/api/dsh-novel-forge/adapt/save";
|
|
136
|
+
/** 改编模式:从源全文 + 编辑后方案提炼新书资料并保存为「待写新书」。 */
|
|
137
|
+
readonly adaptMaterialize: "/api/dsh-novel-forge/adapt/materialize";
|
|
138
|
+
/** 改编模式:rewrite 逐章重写(NDJSON 流式进度)。 */
|
|
139
|
+
readonly adaptRewriteStream: "/api/dsh-novel-forge/adapt/rewrite-stream";
|
|
140
|
+
/** 改编模式:把预览/微调后的新书资料写入并登记书架。 */
|
|
141
|
+
readonly adaptMaterializeSave: "/api/dsh-novel-forge/adapt/materialize-save";
|
|
142
|
+
/** 主题自定义背景:上传图片(POST,存盘并返回服务端 URL)。 */
|
|
143
|
+
readonly themeBackgroundUpload: "/api/dsh-novel-forge/theme/background";
|
|
144
|
+
/** 主题自定义背景:读取已上传文件(GET prefix,/theme/background/<name>)。 */
|
|
145
|
+
readonly themeBackgroundGet: "/api/dsh-novel-forge/theme/background";
|
|
78
146
|
};
|
|
79
147
|
/** 书架:一本书的条目。 */
|
|
80
148
|
export interface BookEntry {
|
|
@@ -121,6 +189,60 @@ export interface BookActivateRequest {
|
|
|
121
189
|
export interface BookRemoveRequest {
|
|
122
190
|
id: string;
|
|
123
191
|
}
|
|
192
|
+
/** POST /bookshelf/import-dir 请求:导入已有项目目录。 */
|
|
193
|
+
export interface BookImportDirRequest {
|
|
194
|
+
/** 项目目录(须含 novel-project.json)。 */
|
|
195
|
+
outputDir: string;
|
|
196
|
+
}
|
|
197
|
+
/** POST /bookshelf/import-dir 响应。 */
|
|
198
|
+
export interface BookImportDirResponse {
|
|
199
|
+
book: BookEntry;
|
|
200
|
+
/** true = 目录已在书架中(本次为重新激活)。 */
|
|
201
|
+
existed: boolean;
|
|
202
|
+
}
|
|
203
|
+
/** POST /bookshelf/import-text 请求:导入 txt/md 全本。两种模式二选一:
|
|
204
|
+
* - filePath:服务器本地文件路径;
|
|
205
|
+
* - text + fileName:浏览器上传的全文内容(fileName 用于推断书名)。
|
|
206
|
+
*/
|
|
207
|
+
export interface BookImportTextRequest {
|
|
208
|
+
/** 模式一:源文件绝对路径(txt 或 md)。 */
|
|
209
|
+
filePath?: string;
|
|
210
|
+
/** 模式二:浏览器上传的全文内容。 */
|
|
211
|
+
text?: string;
|
|
212
|
+
/** 模式二:原文件名(txt/md),用于推断书名与显示。 */
|
|
213
|
+
fileName?: string;
|
|
214
|
+
/** 输出目录;缺省为 ~/.dsh/novels/书名。 */
|
|
215
|
+
outputDir?: string;
|
|
216
|
+
}
|
|
217
|
+
/** POST /bookshelf/import-text 响应。 */
|
|
218
|
+
export interface BookImportTextResponse {
|
|
219
|
+
bookName: string;
|
|
220
|
+
/** 成功拆出的章节数。 */
|
|
221
|
+
chapters: number;
|
|
222
|
+
/** 因内容过短被跳过的章节标题列表。 */
|
|
223
|
+
skipped: string[];
|
|
224
|
+
/** 登记后的书架条目。 */
|
|
225
|
+
book: BookEntry;
|
|
226
|
+
}
|
|
227
|
+
/** POST /bookshelf/import-text/preview 请求:上传全文做拆章预览(不落盘)。 */
|
|
228
|
+
export interface BookImportTextPreviewRequest {
|
|
229
|
+
text: string;
|
|
230
|
+
/** 原文件名(txt/md),用于推断书名。 */
|
|
231
|
+
fileName?: string;
|
|
232
|
+
}
|
|
233
|
+
/** POST /bookshelf/import-text/preview 响应。 */
|
|
234
|
+
export interface BookImportTextPreviewResponse {
|
|
235
|
+
/** 预计书名(fileName 去扩展名)。 */
|
|
236
|
+
bookName: string;
|
|
237
|
+
/** 识别出的章节(已按正文长度过滤过短章节)。 */
|
|
238
|
+
chapters: Array<{
|
|
239
|
+
no: number;
|
|
240
|
+
title: string;
|
|
241
|
+
chars: number;
|
|
242
|
+
}>;
|
|
243
|
+
/** 因内容过短被跳过的章节标题列表。 */
|
|
244
|
+
skipped: string[];
|
|
245
|
+
}
|
|
124
246
|
/** Chapter lifecycle states (the writing pipeline's state machine). */
|
|
125
247
|
export type ChapterStatus = 'pending' | 'generating' | 'written' | 'reviewing' | 'approved' | 'rejected' | 'error';
|
|
126
248
|
/** One chapter in the plan. */
|
|
@@ -135,6 +257,22 @@ export interface ChapterPlan {
|
|
|
135
257
|
beats: string;
|
|
136
258
|
/** Target character count (defaults to the configured chapter size). */
|
|
137
259
|
targetChars: number;
|
|
260
|
+
/** 本章必达项(必须推进的局面/关系/信息/风险/决策变化)。 */
|
|
261
|
+
mustAdvance?: string[];
|
|
262
|
+
/** 本章必须保持/不得破坏的项(如人物状态、已有伏笔不提前揭)。 */
|
|
263
|
+
mustPreserve?: string[];
|
|
264
|
+
/** 本章不可违背的人物硬事实(身份/阵营/境界/当前位置/知情度)。 */
|
|
265
|
+
characterHardFacts?: string[];
|
|
266
|
+
/** 伏笔操作指令(seed/touch/pressure/partial_reveal/payoff/forbid)。 */
|
|
267
|
+
payoffDirectives?: Array<{
|
|
268
|
+
no?: number;
|
|
269
|
+
operation?: 'seed' | 'touch' | 'pressure' | 'partial_reveal' | 'payoff' | 'forbid';
|
|
270
|
+
text?: string;
|
|
271
|
+
}>;
|
|
272
|
+
/** 章末钩子要求(悬念/反转/新线索/未闭合选择)。 */
|
|
273
|
+
endingHook?: string;
|
|
274
|
+
/** 本章义务合约(人类可读摘要,供生成与审稿共同锚定)。 */
|
|
275
|
+
obligation?: string;
|
|
138
276
|
/** Generation/review state. */
|
|
139
277
|
status: ChapterStatus;
|
|
140
278
|
/** 进入 generating 的时间(用于超时自动复位;未在生成时无此字段)。 */
|
|
@@ -173,17 +311,41 @@ export interface AuthorReview {
|
|
|
173
311
|
continuity: string;
|
|
174
312
|
/** 近期节奏趋势提示(拖沓/爽点密度等)。 */
|
|
175
313
|
trend: string;
|
|
314
|
+
/** 本章发生的关键状态变化(人物状态/世界局面/关系/资源),用于回灌整本与事实库。 */
|
|
315
|
+
stateChanges?: string[];
|
|
316
|
+
/** 本章新引入或升级的冲突(供整本控制层与后续卷节奏参考)。 */
|
|
317
|
+
newConflicts?: string[];
|
|
318
|
+
/** 本章埋下/推进的新线索(供知识与伏笔系统回灌)。 */
|
|
319
|
+
clues?: string[];
|
|
320
|
+
/** 本章缺席但值得注意的角色及风险(卷级职责/缺席风险)。 */
|
|
321
|
+
absentRisks?: string[];
|
|
176
322
|
/** 复盘时间。 */
|
|
177
323
|
reviewedAt: string;
|
|
178
324
|
}
|
|
325
|
+
/** 审稿维度(结构化定位问题类别;与 review-policy.ts 的 REVIEW_DIMENSIONS 对齐)。 */
|
|
326
|
+
export type ReviewDimension = 'character' | 'setting' | 'redline' | 'writing' | 'pacing' | 'logic' | 'anti-ai' | 'presentation' | 'compliance';
|
|
179
327
|
/** One review finding. */
|
|
180
328
|
export interface ReviewIssue {
|
|
181
329
|
/** Severity: high = must fix, medium = should fix, low = suggestion. */
|
|
182
330
|
severity: 'high' | 'medium' | 'low';
|
|
331
|
+
/** 问题维度(可选;缺省由前端按 item 推断)。 */
|
|
332
|
+
dimension?: ReviewDimension;
|
|
183
333
|
/** What the problem is. */
|
|
184
334
|
item: string;
|
|
185
335
|
/** Concrete suggestion for fixing it. */
|
|
186
336
|
suggestion: string;
|
|
337
|
+
/** 命中的反 AI 规则名(结构化,便于统计)。 */
|
|
338
|
+
ruleName?: string;
|
|
339
|
+
/** 规则类别:forbidden / risk / encourage。 */
|
|
340
|
+
ruleType?: 'forbidden' | 'risk' | 'encourage';
|
|
341
|
+
/** 问题细分类(如 套话 句式 段落 心理 设定)。 */
|
|
342
|
+
category?: string;
|
|
343
|
+
/** 命中的原文摘录。 */
|
|
344
|
+
excerpt?: string;
|
|
345
|
+
/** 判定理由。 */
|
|
346
|
+
reason?: string;
|
|
347
|
+
/** 是否可自动改写。 */
|
|
348
|
+
canAutoRewrite?: boolean;
|
|
187
349
|
}
|
|
188
350
|
/** AI review report for one chapter. */
|
|
189
351
|
export interface ReviewReport {
|
|
@@ -195,6 +357,15 @@ export interface ReviewReport {
|
|
|
195
357
|
verdict: string;
|
|
196
358
|
/** Individual findings. */
|
|
197
359
|
issues: ReviewIssue[];
|
|
360
|
+
/** 风险分 0-100(越高越需人工处理;源自 LLM 复核与本地扫描)。 */
|
|
361
|
+
riskScore?: number;
|
|
362
|
+
/** 本地 AI 味指数 0-100(越高越像 AI;LLM 复核锚点,供 UI 展示)。 */
|
|
363
|
+
aiFlavor?: number;
|
|
364
|
+
/** 本地扫描命中的高频套话(按次数降序,取前若干)。 */
|
|
365
|
+
aiPhrases?: Array<{
|
|
366
|
+
word: string;
|
|
367
|
+
count: number;
|
|
368
|
+
}>;
|
|
198
369
|
/** When the review ran. */
|
|
199
370
|
reviewedAt: string;
|
|
200
371
|
}
|
|
@@ -210,6 +381,155 @@ export interface Volume {
|
|
|
210
381
|
chapterStart: number;
|
|
211
382
|
/** Last chapter number (inclusive). */
|
|
212
383
|
chapterEnd: number;
|
|
384
|
+
/** 卷级战略(这一卷的定位/承转,如「立威卷」「冲突升级卷」)。 */
|
|
385
|
+
strategy?: string;
|
|
386
|
+
/** 卷节奏板(这一卷的节奏安排:起-承-转-合/爽点密度/关键节点)。 */
|
|
387
|
+
pacing?: string;
|
|
388
|
+
}
|
|
389
|
+
/** 开书定盘:面向读者的承诺与流派定位(生成/规划均可引用)。 */
|
|
390
|
+
export interface BookContract {
|
|
391
|
+
/** 一句话卖点/题材承诺。 */
|
|
392
|
+
promise?: string;
|
|
393
|
+
/** 主推进模式名(从推进模式库选)。 */
|
|
394
|
+
primaryModeName?: string;
|
|
395
|
+
/** 辅助推进模式名。 */
|
|
396
|
+
secondaryModeNames?: string[];
|
|
397
|
+
/** 整体文风基调(一句话)。 */
|
|
398
|
+
tone?: string;
|
|
399
|
+
/** 目标平台(如「番茄」)。 */
|
|
400
|
+
targetPlatform?: string;
|
|
401
|
+
}
|
|
402
|
+
/** 书内知识库文档(供生成/规划时检索注入的参考资料)。 */
|
|
403
|
+
export interface KnowledgeDoc {
|
|
404
|
+
id: string;
|
|
405
|
+
title: string;
|
|
406
|
+
content: string;
|
|
407
|
+
updatedAt: string;
|
|
408
|
+
}
|
|
409
|
+
/** POST /knowledge request:增删改知识库文档。 */
|
|
410
|
+
export interface KnowledgeRequest {
|
|
411
|
+
action: 'add' | 'remove' | 'replace';
|
|
412
|
+
doc?: {
|
|
413
|
+
id?: string;
|
|
414
|
+
title: string;
|
|
415
|
+
content: string;
|
|
416
|
+
};
|
|
417
|
+
id?: string;
|
|
418
|
+
}
|
|
419
|
+
/** POST /book-analysis request。 */
|
|
420
|
+
export interface BookAnalysisRequest {
|
|
421
|
+
text: string;
|
|
422
|
+
}
|
|
423
|
+
/** 书分析/拆书结果。 */
|
|
424
|
+
export interface BookAnalysisResult {
|
|
425
|
+
sellingPoints: string[];
|
|
426
|
+
structure: string[];
|
|
427
|
+
lessons: string[];
|
|
428
|
+
risks: string[];
|
|
429
|
+
}
|
|
430
|
+
/** POST /idea-inspiration request。 */
|
|
431
|
+
export interface IdeaInspirationRequest {
|
|
432
|
+
idea: string;
|
|
433
|
+
count?: number;
|
|
434
|
+
}
|
|
435
|
+
/** 创意灵感结果:多方向开书灵感。 */
|
|
436
|
+
export interface IdeaInspirationResult {
|
|
437
|
+
ideas: Array<{
|
|
438
|
+
title: string;
|
|
439
|
+
hook: string;
|
|
440
|
+
genre: string;
|
|
441
|
+
pov: string;
|
|
442
|
+
payoff: string;
|
|
443
|
+
}>;
|
|
444
|
+
}
|
|
445
|
+
/** POST /director request。 */
|
|
446
|
+
export interface DirectorRequest {
|
|
447
|
+
focus?: string;
|
|
448
|
+
}
|
|
449
|
+
/** 自动导演编排建议(下一卷/阶段编排 + 修复再平衡)。 */
|
|
450
|
+
export interface DirectorAdvice {
|
|
451
|
+
summary: string;
|
|
452
|
+
nextArc: string[];
|
|
453
|
+
pacing: string;
|
|
454
|
+
risks: string[];
|
|
455
|
+
fixes: string[];
|
|
456
|
+
}
|
|
457
|
+
/** 自动导演「采纳」后生成的书内待办项。 */
|
|
458
|
+
export interface DirectorTodo {
|
|
459
|
+
id: string;
|
|
460
|
+
text: string;
|
|
461
|
+
/** 来源:风险 或 修复。 */
|
|
462
|
+
source: 'risk' | 'fix';
|
|
463
|
+
done: boolean;
|
|
464
|
+
createdAt: string;
|
|
465
|
+
}
|
|
466
|
+
/** 题材雷达:单条市场信号。 */
|
|
467
|
+
export interface MarketRadarSignal {
|
|
468
|
+
id: string;
|
|
469
|
+
kind: 'genre' | 'protagonist' | 'advantage' | 'opening' | 'relationship' | 'title_pattern' | 'opportunity' | 'crowding';
|
|
470
|
+
title: string;
|
|
471
|
+
detail: string;
|
|
472
|
+
/** 趋势:current / rising / stable / falling。 */
|
|
473
|
+
direction?: 'current' | 'rising' | 'stable' | 'falling';
|
|
474
|
+
/** 是否建议优先考虑。 */
|
|
475
|
+
recommended?: boolean;
|
|
476
|
+
}
|
|
477
|
+
/** 题材雷达:生产底座(引用内置题材/推进模式库,或给出新资产)。 */
|
|
478
|
+
export interface ProductionFoundation {
|
|
479
|
+
genre: {
|
|
480
|
+
existingId?: string;
|
|
481
|
+
name: string;
|
|
482
|
+
description: string;
|
|
483
|
+
template?: string;
|
|
484
|
+
};
|
|
485
|
+
primaryStoryMode: {
|
|
486
|
+
existingId?: string;
|
|
487
|
+
name: string;
|
|
488
|
+
driver: string;
|
|
489
|
+
readerExpectation: string;
|
|
490
|
+
};
|
|
491
|
+
secondaryStoryMode?: {
|
|
492
|
+
existingId?: string;
|
|
493
|
+
name: string;
|
|
494
|
+
driver: string;
|
|
495
|
+
readerExpectation: string;
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
/** 题材雷达:开书创意简报(可执行,严禁照搬具体作品/命名)。 */
|
|
499
|
+
export interface MarketCreativeBrief {
|
|
500
|
+
promptBlock: string;
|
|
501
|
+
openingIdea: string;
|
|
502
|
+
coreAdvantage: string;
|
|
503
|
+
bookSellingPoint: string;
|
|
504
|
+
first30ChapterPromise: string;
|
|
505
|
+
}
|
|
506
|
+
/** 题材雷达结果。 */
|
|
507
|
+
export interface MarketRadarResult {
|
|
508
|
+
signals: MarketRadarSignal[];
|
|
509
|
+
productionFoundation: ProductionFoundation;
|
|
510
|
+
/** 开书创意简报(可选;用「用信号创作」接口单独生成)。 */
|
|
511
|
+
creativeBrief?: MarketCreativeBrief;
|
|
512
|
+
}
|
|
513
|
+
/** POST /market-radar request。 */
|
|
514
|
+
export interface MarketRadarRequest {
|
|
515
|
+
platform?: string;
|
|
516
|
+
genre?: string;
|
|
517
|
+
keywords?: string;
|
|
518
|
+
feedText?: string;
|
|
519
|
+
/** 已扫描的上榜记录(来自真实榜单抓取),用于让分析基于真实榜单证据。 */
|
|
520
|
+
candidates?: Array<{
|
|
521
|
+
title: string;
|
|
522
|
+
author?: string;
|
|
523
|
+
tags?: string[];
|
|
524
|
+
synopsis?: string;
|
|
525
|
+
category?: string;
|
|
526
|
+
heatLabel?: string;
|
|
527
|
+
}>;
|
|
528
|
+
}
|
|
529
|
+
/** POST /market-radar/brief request:用选中的信号 + 影响模式生成开书创意。 */
|
|
530
|
+
export interface MarketRadarBriefRequest {
|
|
531
|
+
influenceMode: 'follow_hot' | 'differentiate' | 'light';
|
|
532
|
+
signals: MarketRadarSignal[];
|
|
213
533
|
}
|
|
214
534
|
/** A character card from the story bible. */
|
|
215
535
|
export interface CharacterCard {
|
|
@@ -278,6 +598,28 @@ export interface AuditResponse {
|
|
|
278
598
|
auditedChapters: number;
|
|
279
599
|
/** 质检时间。 */
|
|
280
600
|
auditedAt: string;
|
|
601
|
+
/** 本次质检使用的模型(auditModel 或全局 model)。 */
|
|
602
|
+
model?: string;
|
|
603
|
+
}
|
|
604
|
+
/** 全书质检的实时状态(通过 /status 暴露给面板/外部读取)。 */
|
|
605
|
+
export interface AuditStatus {
|
|
606
|
+
status: 'idle' | 'running' | 'done' | 'error';
|
|
607
|
+
/** 开始时间(ISO)。 */
|
|
608
|
+
startedAt?: string;
|
|
609
|
+
/** 结束时间(ISO)。 */
|
|
610
|
+
finishedAt?: string;
|
|
611
|
+
/** 总批次数(0 = 尚未开始/无章节)。 */
|
|
612
|
+
totalBatches: number;
|
|
613
|
+
/** 已完成批次数。 */
|
|
614
|
+
completedBatches: number;
|
|
615
|
+
/** 参与质检的章节数。 */
|
|
616
|
+
auditedChapters?: number;
|
|
617
|
+
/** 发现的问题数(done 后有效)。 */
|
|
618
|
+
issuesCount?: number;
|
|
619
|
+
/** 最近一次质检的问题清单(done 后有效;error 时为空)。 */
|
|
620
|
+
issues?: AuditIssue[];
|
|
621
|
+
/** 失败信息(error 时有效)。 */
|
|
622
|
+
error?: string;
|
|
281
623
|
}
|
|
282
624
|
/** 一条剧情线(主线/支线/人物线/悬念线)。 */
|
|
283
625
|
export interface Plotline {
|
|
@@ -324,7 +666,7 @@ export interface PlotlineHealthReport {
|
|
|
324
666
|
note: string;
|
|
325
667
|
}>;
|
|
326
668
|
}
|
|
327
|
-
/**
|
|
669
|
+
/** 剧情方案:下一阶段目标 + 建议新线。 */
|
|
328
670
|
export interface PlotlinePlan {
|
|
329
671
|
/** 下一阶段(未来 5-10 章)剧情方向。 */
|
|
330
672
|
direction: string;
|
|
@@ -334,7 +676,7 @@ export interface PlotlinePlan {
|
|
|
334
676
|
/** POST /plotlines 响应。 */
|
|
335
677
|
export interface PlotlinesResponse {
|
|
336
678
|
plotlines: Plotline[];
|
|
337
|
-
/** op=suggest 时的
|
|
679
|
+
/** op=suggest 时的 建议候选线。 */
|
|
338
680
|
suggestions?: Plotline[];
|
|
339
681
|
/** op=health 时的健康检查报告。 */
|
|
340
682
|
health?: PlotlineHealthReport;
|
|
@@ -431,91 +773,6 @@ export interface BreakdownResponse {
|
|
|
431
773
|
/** 估算消耗 token。 */
|
|
432
774
|
usedTokens: number;
|
|
433
775
|
}
|
|
434
|
-
/** 漫剧分镜:一个角色锚点卡。 */
|
|
435
|
-
export interface StoryboardCharacterCard {
|
|
436
|
-
name: string;
|
|
437
|
-
/** 视觉锚点:发型/五官/体型/标志物(中文描述)。 */
|
|
438
|
-
visualAnchor: string;
|
|
439
|
-
/** AI 标签组(英文,全分镜强制复用)。 */
|
|
440
|
-
tags: string;
|
|
441
|
-
/** 情绪表情库(英文,按需调用)。 */
|
|
442
|
-
expressions: string[];
|
|
443
|
-
}
|
|
444
|
-
/** 漫剧分镜:一个分镜格。 */
|
|
445
|
-
export interface StoryboardPanel {
|
|
446
|
-
/** 序号。 */
|
|
447
|
-
index: number;
|
|
448
|
-
/** 时间码(如 0:00-0:03)。 */
|
|
449
|
-
timecode: string;
|
|
450
|
-
/** 景别(特写/中景/全景…)。 */
|
|
451
|
-
shot: string;
|
|
452
|
-
/** 画面描述(具象动作,非抽象情感)。 */
|
|
453
|
-
visual: string;
|
|
454
|
-
/** 台词(情绪标签 + 内容)。 */
|
|
455
|
-
dialogue: string;
|
|
456
|
-
/** 转场/动效。 */
|
|
457
|
-
transition: string;
|
|
458
|
-
/** AI 提示词(英文标签,豆包/SD 通用)。 */
|
|
459
|
-
prompt: string;
|
|
460
|
-
}
|
|
461
|
-
/** POST /storyboard 请求:章节 → 漫剧分镜。 */
|
|
462
|
-
export interface StoryboardRequest {
|
|
463
|
-
chapterNo: number;
|
|
464
|
-
/** 赛道类型:爽文/甜宠/悬疑/搞笑(留空由 AI 推断)。 */
|
|
465
|
-
genre?: string;
|
|
466
|
-
/** 目标平台(抖音/快手/B站…,默认抖音)。 */
|
|
467
|
-
platform?: string;
|
|
468
|
-
/** AI 工具偏好:doubao / seedance / sd / mj(影响提示词格式,默认 doubao)。 */
|
|
469
|
-
tool?: string;
|
|
470
|
-
}
|
|
471
|
-
/** POST /storyboard 响应。 */
|
|
472
|
-
export interface StoryboardResponse {
|
|
473
|
-
/** 本集标题。 */
|
|
474
|
-
title: string;
|
|
475
|
-
/** 赛道与节奏说明。 */
|
|
476
|
-
pacingNote: string;
|
|
477
|
-
/** 本集钩子(结尾悬念)。 */
|
|
478
|
-
hook: string;
|
|
479
|
-
/** 角色锚点卡。 */
|
|
480
|
-
characters: StoryboardCharacterCard[];
|
|
481
|
-
/** 分镜表。 */
|
|
482
|
-
panels: StoryboardPanel[];
|
|
483
|
-
/** 结尾钩子台词。 */
|
|
484
|
-
endingHook: string;
|
|
485
|
-
}
|
|
486
|
-
/** 漫剧分集计划:一集(含 1-N 章)。 */
|
|
487
|
-
export interface StoryboardEpisode {
|
|
488
|
-
/** 集号。 */
|
|
489
|
-
index: number;
|
|
490
|
-
/** 集标题(冲突+悬念句式)。 */
|
|
491
|
-
title: string;
|
|
492
|
-
/** 涵盖章节号。 */
|
|
493
|
-
chapters: number[];
|
|
494
|
-
/** 叙事任务:这集讲什么、为什么这么分。 */
|
|
495
|
-
narrativeJob: string;
|
|
496
|
-
/** 开头钩子。 */
|
|
497
|
-
openingHook: string;
|
|
498
|
-
/** 结尾钩子(逼看下集)。 */
|
|
499
|
-
endingHook: string;
|
|
500
|
-
}
|
|
501
|
-
/** POST /storyboard/plan 请求:读一卷 → 输出漫剧分集计划。 */
|
|
502
|
-
export interface StoryboardPlanRequest {
|
|
503
|
-
/** 卷号(1-5)。 */
|
|
504
|
-
volumeNo: number;
|
|
505
|
-
/** 目标平台(默认抖音)。 */
|
|
506
|
-
platform?: string;
|
|
507
|
-
/** 每集约 1-2 分钟,最多多少集(默认 25)。 */
|
|
508
|
-
maxEpisodes?: number;
|
|
509
|
-
}
|
|
510
|
-
/** POST /storyboard/plan 响应。 */
|
|
511
|
-
export interface StoryboardPlanResponse {
|
|
512
|
-
/** 本卷漫剧化的叙事策略说明。 */
|
|
513
|
-
strategy: string;
|
|
514
|
-
/** 分集计划。 */
|
|
515
|
-
episodes: StoryboardEpisode[];
|
|
516
|
-
/** 参与规划的章节数。 */
|
|
517
|
-
chaptersScanned: number;
|
|
518
|
-
}
|
|
519
776
|
/** 角色卡:角色当前状态(从事实库聚合)。 */
|
|
520
777
|
export interface RoleStatusCard {
|
|
521
778
|
name: string;
|
|
@@ -528,7 +785,7 @@ export interface RoleStatusCard {
|
|
|
528
785
|
/** 出场次数。 */
|
|
529
786
|
appearances: number;
|
|
530
787
|
}
|
|
531
|
-
/** 角色库条目(主表:作者维护 +
|
|
788
|
+
/** 角色库条目(主表:作者维护 + 提炼 + 编年录自动聚合)。 */
|
|
532
789
|
export interface RoleRecord {
|
|
533
790
|
/** 角色名(唯一键)。 */
|
|
534
791
|
name: string;
|
|
@@ -548,35 +805,37 @@ export interface RoleRecord {
|
|
|
548
805
|
knowledge: string[];
|
|
549
806
|
/** 首次出场章节(编年录聚合,可手动修正)。 */
|
|
550
807
|
firstChapter?: number;
|
|
551
|
-
/** 动漫形象描述词(AI 绘图用:中文描述 + 英文标签 + 关键外貌标签)。 */
|
|
552
|
-
imagePrompt?: {
|
|
553
|
-
/** 中文外貌描述:连贯一段(发色/瞳色/服装/气质/标志物)。 */
|
|
554
|
-
zh: string;
|
|
555
|
-
/** 英文绘图标签:booru 风格逗号分隔。 */
|
|
556
|
-
en: string;
|
|
557
|
-
/** 中文关键标签(发色/瞳色/服装/气质/标志物)。 */
|
|
558
|
-
tags: string[];
|
|
559
|
-
/** 依据来源说明(哪几章哪些描写)。 */
|
|
560
|
-
source?: string;
|
|
561
|
-
};
|
|
562
808
|
}
|
|
563
|
-
/** POST /roles 请求:角色库增删改 +
|
|
809
|
+
/** POST /roles 请求:角色库增删改 + 提炼 + 参考图上传。 */
|
|
564
810
|
export interface RolesRequest {
|
|
565
|
-
op: 'extract' | 'adopt' | 'update' | 'remove'
|
|
811
|
+
op: 'extract' | 'adopt' | 'update' | 'remove';
|
|
566
812
|
/** adopt / update 时传入的角色(adopt 可修改后采纳)。 */
|
|
567
813
|
role?: RoleRecord;
|
|
568
814
|
/** remove 时的角色名。 */
|
|
569
815
|
name?: string;
|
|
570
816
|
}
|
|
817
|
+
/** POST /llm-test 请求:对选中的提供商/模型发一次最小真实调用。 */
|
|
818
|
+
export interface LlmTestRequest {
|
|
819
|
+
provider: string;
|
|
820
|
+
model: string;
|
|
821
|
+
}
|
|
822
|
+
/** POST /llm-test 响应。 */
|
|
823
|
+
export interface LlmTestResponse {
|
|
824
|
+
ok: boolean;
|
|
825
|
+
/** 连通延迟(毫秒)。 */
|
|
826
|
+
ms?: number;
|
|
827
|
+
/** 失败原因(已映射为人话)。 */
|
|
828
|
+
message?: string;
|
|
829
|
+
/** 稳定错误码(LlmError code),便于排查。 */
|
|
830
|
+
code?: string;
|
|
831
|
+
}
|
|
571
832
|
/** POST /roles 响应。 */
|
|
572
833
|
export interface RolesResponse {
|
|
573
834
|
roles: RoleRecord[];
|
|
574
835
|
/** op=extract 时的 AI 候选角色。 */
|
|
575
836
|
candidates?: RoleRecord[];
|
|
576
|
-
/** op=visual 时的动漫形象描述词(已写入角色卡)。 */
|
|
577
|
-
visual?: RoleRecord['imagePrompt'];
|
|
578
837
|
}
|
|
579
|
-
/** POST /bible/patch
|
|
838
|
+
/** POST /bible/patch 请求:局部修补道藏。 */
|
|
580
839
|
export interface BiblePatchRequest {
|
|
581
840
|
worldRules?: string[];
|
|
582
841
|
redLines?: string[];
|
|
@@ -584,10 +843,10 @@ export interface BiblePatchRequest {
|
|
|
584
843
|
/** 角色卡整体替换(人物志编辑知情度等)。 */
|
|
585
844
|
characters?: CharacterCard[];
|
|
586
845
|
}
|
|
587
|
-
/** POST /blurb
|
|
846
|
+
/** POST /blurb 请求:生成/补全或手动保存小说简介。 */
|
|
588
847
|
export interface BlurbRequest {
|
|
589
848
|
action: 'generate' | 'save';
|
|
590
|
-
/**
|
|
849
|
+
/** 已写好的开头(补全时使用;留空 = 全量生成)。 */
|
|
591
850
|
partial?: string;
|
|
592
851
|
/** 手动保存的完整简介(action=save 时)。 */
|
|
593
852
|
text?: string;
|
|
@@ -650,7 +909,7 @@ export interface WorldState {
|
|
|
650
909
|
regions: WorldRegion[];
|
|
651
910
|
factions: WorldFaction[];
|
|
652
911
|
}
|
|
653
|
-
/** POST /world
|
|
912
|
+
/** POST /world 请求:提炼或手动保存。 */
|
|
654
913
|
export interface WorldRequest {
|
|
655
914
|
action: 'generate' | 'save';
|
|
656
915
|
/** action=save 时的完整世界数据。 */
|
|
@@ -680,23 +939,151 @@ export interface ProjectState {
|
|
|
680
939
|
assets?: ProjectAssets;
|
|
681
940
|
/** 事实库/时间线:每章生成后抽取,注入后续章节保持一致性。 */
|
|
682
941
|
facts?: ChapterFact[];
|
|
683
|
-
/**
|
|
942
|
+
/** 书内知识库文档(可检索资料/设定/参考)。 */
|
|
943
|
+
knowledgeDocs?: KnowledgeDoc[];
|
|
944
|
+
/** 自动导演待办:风险/修复「采纳」后生成的随手清单。 */
|
|
945
|
+
todos?: DirectorTodo[];
|
|
946
|
+
/** 小说简介(面向读者的作品门面,生成或手动保存)。 */
|
|
684
947
|
blurb?: string;
|
|
948
|
+
/** 开书定盘:书籍级承诺与流派定位(前30章承诺/主副模式/文风/平台)。 */
|
|
949
|
+
bookContract?: BookContract;
|
|
685
950
|
/** 封面文件名(相对输出目录,如 cover.png)。 */
|
|
686
951
|
coverPath?: string;
|
|
687
952
|
/** 大世界结构化数据(境界体系/区域/势力)。 */
|
|
688
953
|
world?: WorldState;
|
|
689
954
|
/** 剧情线(主线/支线/人物线/悬念线)。 */
|
|
690
955
|
plotlines?: Plotline[];
|
|
691
|
-
/** 角色库(作者维护 +
|
|
956
|
+
/** 角色库(作者维护 + 提炼的主表)。 */
|
|
692
957
|
roles?: RoleRecord[];
|
|
693
958
|
/** 人物志:角色当前状态聚合结果(从编年录刷新后存档,打开页面直接显示)。 */
|
|
694
959
|
roleStatus?: RoleStatusCard[];
|
|
960
|
+
/** 本书参数(写作/审稿/推理/模型快切;未设字段回退全局 config)。 */
|
|
961
|
+
bookSettings?: BookSettings;
|
|
695
962
|
/** ISO timestamps. */
|
|
696
963
|
createdAt: string;
|
|
697
964
|
updatedAt: string;
|
|
698
965
|
}
|
|
699
|
-
/**
|
|
966
|
+
/** 本书参数(存 novel-project.json.bookSettings;未设字段回退全局 config)。 */
|
|
967
|
+
export interface BookSettings {
|
|
968
|
+
/** 本书使用的提供方路由(快切器写入)。 */
|
|
969
|
+
provider?: string;
|
|
970
|
+
/** 本书使用的主模型 id。 */
|
|
971
|
+
model?: string;
|
|
972
|
+
/** 本书写作推理档位。 */
|
|
973
|
+
reasoningEffort?: 'off' | 'low' | 'high' | 'max';
|
|
974
|
+
/** 本书分析类任务推理档位。 */
|
|
975
|
+
analysisReasoning?: 'off' | 'low' | 'high' | 'max';
|
|
976
|
+
/** 本书每章目标字数。 */
|
|
977
|
+
chapterChars?: number;
|
|
978
|
+
/** 本书单章最大输出 tokens。 */
|
|
979
|
+
maxTokens?: number;
|
|
980
|
+
/** 本书审稿通过分。 */
|
|
981
|
+
reviewPassScore?: number;
|
|
982
|
+
/** 本书是否写完自动审稿。 */
|
|
983
|
+
autoReview?: boolean;
|
|
984
|
+
/** 本书是否自动作者复盘。 */
|
|
985
|
+
autoAuthorReview?: boolean;
|
|
986
|
+
/** 本书是否修稿后自动复审。 */
|
|
987
|
+
autoReviewAfterRevise?: boolean;
|
|
988
|
+
}
|
|
989
|
+
/** 手动添加的模型库条目(只存插件内,不改 DSH 全局)。 */
|
|
990
|
+
export interface SavedModel {
|
|
991
|
+
/** 唯一 id(前端生成的短 id)。 */
|
|
992
|
+
id: string;
|
|
993
|
+
/** 展示名(可为空,回退到 model)。 */
|
|
994
|
+
name: string;
|
|
995
|
+
/** DSH 提供商路由(如 zai-coding-cn)。 */
|
|
996
|
+
provider: string;
|
|
997
|
+
/** 模型 id(如 glm-5.3-flash)。 */
|
|
998
|
+
model: string;
|
|
999
|
+
}
|
|
1000
|
+
/** DSH 模型添加:厂商预设(选择厂商,直接填 API Key)。 */
|
|
1001
|
+
export interface LlmVendor {
|
|
1002
|
+
id: string;
|
|
1003
|
+
name: string;
|
|
1004
|
+
/** 该厂商对应的 provider 路由。 */
|
|
1005
|
+
route: string;
|
|
1006
|
+
/** DSH 凭据引用名(写入 .credentials.yaml 的 refs)。 */
|
|
1007
|
+
apiKeyEnv: string;
|
|
1008
|
+
/** 默认模型 id。 */
|
|
1009
|
+
defaultModel: string;
|
|
1010
|
+
/** 建议可选模型 id 列表(下拉 data-list 用)。 */
|
|
1011
|
+
models: string[];
|
|
1012
|
+
/** 内置适配器(如 deepseek-official),无需注册 pi-ai 路由。 */
|
|
1013
|
+
builtin?: boolean;
|
|
1014
|
+
}
|
|
1015
|
+
/** 预置的常见厂商(id=provider 路由;添加模型下拉兜底用,其余厂商由运行时目录动态补充)。 */
|
|
1016
|
+
export declare const LLM_VENDORS: LlmVendor[];
|
|
1017
|
+
/** 运行时厂商目录的一项(添加到模型下拉;由 DSH 的 pi-ai 可配置提供方动态生成)。 */
|
|
1018
|
+
export interface LlmVendorOption {
|
|
1019
|
+
/** provider 路由 id(也是厂商下拉的值)。 */
|
|
1020
|
+
id: string;
|
|
1021
|
+
/** 展示名。 */
|
|
1022
|
+
name: string;
|
|
1023
|
+
/** 建议模型 id(可为空,用户手填)。 */
|
|
1024
|
+
models: string[];
|
|
1025
|
+
/** 已知 DSH 凭据引用名;为空时 host 生成 `PI_AI_<ID>_API_KEY`。 */
|
|
1026
|
+
apiKeyEnv?: string;
|
|
1027
|
+
/** 内置适配器(只写凭据,不注册 pi-ai 路由)。 */
|
|
1028
|
+
builtin?: boolean;
|
|
1029
|
+
}
|
|
1030
|
+
/** GET /llm-vendors 响应。 */
|
|
1031
|
+
export interface LlmVendorsResponse {
|
|
1032
|
+
vendors: LlmVendorOption[];
|
|
1033
|
+
}
|
|
1034
|
+
/** /llm-models 里的一条模型。 */
|
|
1035
|
+
export interface LlmModelOption {
|
|
1036
|
+
id: string;
|
|
1037
|
+
name: string;
|
|
1038
|
+
}
|
|
1039
|
+
/** GET /llm-models?provider=x 响应。 */
|
|
1040
|
+
export interface LlmModelsResponse {
|
|
1041
|
+
models: LlmModelOption[];
|
|
1042
|
+
}
|
|
1043
|
+
/** GET /llm-providers 响应:当前已注册的提供方路由。 */
|
|
1044
|
+
export interface LlmProvidersResponse {
|
|
1045
|
+
providers: {
|
|
1046
|
+
id: string;
|
|
1047
|
+
name: string;
|
|
1048
|
+
}[];
|
|
1049
|
+
}
|
|
1050
|
+
/** POST /llm-remove 请求:移除一个提供方(unset key + 移除 llm-pi-ai 路由)。 */
|
|
1051
|
+
export interface RemoveProviderRequest {
|
|
1052
|
+
provider: string;
|
|
1053
|
+
/** 该提供方对应的 DSH 凭据引用名(用于 unset)。 */
|
|
1054
|
+
apiKeyEnv?: string;
|
|
1055
|
+
}
|
|
1056
|
+
/** POST /llm-remove 响应。 */
|
|
1057
|
+
export interface RemoveProviderResponse {
|
|
1058
|
+
ok: boolean;
|
|
1059
|
+
message?: string;
|
|
1060
|
+
}
|
|
1061
|
+
/** POST /llm-add 请求:添加一个模型(厂商直填 key,或自定义路由)。 */
|
|
1062
|
+
export interface AddModelRequest {
|
|
1063
|
+
mode: 'vendor' | 'custom';
|
|
1064
|
+
/** 厂商模式用:provider 路由 id(来自 /llm-vendors)。 */
|
|
1065
|
+
vendor?: string;
|
|
1066
|
+
/** 厂商已知的 DSH 凭据引用名(可选;为空时 host 生成)。 */
|
|
1067
|
+
apiKeyEnv?: string;
|
|
1068
|
+
/** 自定义模式用:provider 路由 id。 */
|
|
1069
|
+
provider?: string;
|
|
1070
|
+
/** 模型 id。 */
|
|
1071
|
+
model: string;
|
|
1072
|
+
/** API Key。 */
|
|
1073
|
+
apiKey: string;
|
|
1074
|
+
/** 展示名(可选)。 */
|
|
1075
|
+
name?: string;
|
|
1076
|
+
/** 自定义模式用:OpenAI 兼容 base URL。 */
|
|
1077
|
+
baseURL?: string;
|
|
1078
|
+
}
|
|
1079
|
+
/** POST /llm-add 响应。 */
|
|
1080
|
+
export interface AddModelResponse {
|
|
1081
|
+
ok: boolean;
|
|
1082
|
+
saved: SavedModel;
|
|
1083
|
+
provider: string;
|
|
1084
|
+
message?: string;
|
|
1085
|
+
}
|
|
1086
|
+
/** 手动添加的模型库条目(只存插件内,不改 DSH 全局)。 */
|
|
700
1087
|
export interface NovelConfig {
|
|
701
1088
|
/** Absolute path of the default docx outline to load. */
|
|
702
1089
|
outlinePath: string;
|
|
@@ -704,8 +1091,18 @@ export interface NovelConfig {
|
|
|
704
1091
|
outputDir: string;
|
|
705
1092
|
/** LLM provider route (e.g. deepseek-official). */
|
|
706
1093
|
provider: string;
|
|
707
|
-
/** LLM model id (e.g. deepseek-
|
|
1094
|
+
/** LLM model id (e.g. deepseek-flash). */
|
|
708
1095
|
model: string;
|
|
1096
|
+
/** 生成正文用模型(缺省用 model)。 */
|
|
1097
|
+
generateModel?: string;
|
|
1098
|
+
/** 审稿用模型(缺省用 model;建议用更强的 reasoner/pro)。 */
|
|
1099
|
+
reviewModel?: string;
|
|
1100
|
+
/** 全书质检(审计)用模型(缺省用 model)。 */
|
|
1101
|
+
auditModel?: string;
|
|
1102
|
+
/** LLM reasoning effort: off = no thinking; low/high/max = thinking intensity. */
|
|
1103
|
+
reasoningEffort: 'off' | 'low' | 'high' | 'max';
|
|
1104
|
+
/** 分析类任务(提炼/拆书/反推大纲等)的推理档位;默认 low,不受上面写作档位影响。 */
|
|
1105
|
+
analysisReasoning: 'off' | 'low' | 'high' | 'max';
|
|
709
1106
|
/** Target characters per chapter. */
|
|
710
1107
|
chapterChars: number;
|
|
711
1108
|
/** Max output tokens per chapter call. */
|
|
@@ -718,14 +1115,129 @@ export interface NovelConfig {
|
|
|
718
1115
|
autoAuthorReview: boolean;
|
|
719
1116
|
/** 修订/润色产出草稿后是否自动附带一次 AI 审查(工作区显示新稿评分与剩余问题)。 */
|
|
720
1117
|
autoReviewAfterRevise: boolean;
|
|
1118
|
+
/** 自定义背景图(URL 或 dataURL 或服务端路径引用;空 = 使用主题默认背景)。 */
|
|
1119
|
+
themeBackground?: string;
|
|
1120
|
+
/** 自定义背景遮罩/模糊强度 0-80(0 = 不遮罩)。 */
|
|
1121
|
+
themeBackgroundBlur?: number;
|
|
1122
|
+
/** 玻璃透明度 0-100(100=当前原样,越小越透,新拟态/黏土可见背景图)。 */
|
|
1123
|
+
themeOpacity?: number;
|
|
1124
|
+
/** 是否启用改编模式(默认关闭;发布后开启)。 */
|
|
1125
|
+
enableAdaptMode?: boolean;
|
|
1126
|
+
/** 手动添加的模型库(「我的模型」条目;只存插件内)。 */
|
|
1127
|
+
savedModels?: SavedModel[];
|
|
1128
|
+
}
|
|
1129
|
+
/** POST /move-output-dir request:dryRun=true 仅预览;确认时须带 to。 */
|
|
1130
|
+
export interface MoveOutputDirRequest {
|
|
1131
|
+
/** 新输出目录(绝对路径)。 */
|
|
1132
|
+
to?: string;
|
|
1133
|
+
/** 只列出当前目录内容,不搬移。 */
|
|
1134
|
+
dryRun?: boolean;
|
|
1135
|
+
}
|
|
1136
|
+
/** POST /move-output-dir response。 */
|
|
1137
|
+
export interface MoveOutputDirResponse {
|
|
1138
|
+
from: string;
|
|
1139
|
+
to?: string;
|
|
1140
|
+
/** 当前(或迁移后)目录内容清单。 */
|
|
1141
|
+
files: string[];
|
|
1142
|
+
bytes: number;
|
|
1143
|
+
/** 联动重指向的书架条目数。 */
|
|
1144
|
+
movedBooks: number;
|
|
1145
|
+
/** settings 默认输出目录是否同步更新。 */
|
|
1146
|
+
defaultUpdated: boolean;
|
|
1147
|
+
}
|
|
1148
|
+
/** POST /book-settings request:patch 省略 = 读取;字段传 null = 删除本书覆盖(回退全局)。 */
|
|
1149
|
+
export interface BookSettingsRequest {
|
|
1150
|
+
patch?: {
|
|
1151
|
+
[K in keyof BookSettings]?: BookSettings[K] | null;
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
/** POST /book-settings response。 */
|
|
1155
|
+
export interface BookSettingsResponse {
|
|
1156
|
+
/** 本书已设置的参数(未设字段缺省 = 回退全局)。 */
|
|
1157
|
+
settings: BookSettings;
|
|
1158
|
+
/** 应用回退链后的生效配置(全局 + 本书覆盖)。 */
|
|
1159
|
+
effective: NovelConfig;
|
|
1160
|
+
/** 当前是否有打开的书。 */
|
|
1161
|
+
hasBook: boolean;
|
|
721
1162
|
}
|
|
722
1163
|
/** GET /status response. */
|
|
1164
|
+
/**
|
|
1165
|
+
* 创作阶段契约(宿主计算的「当前阶段 → 本轮允许的动作」)。
|
|
1166
|
+
* 计算逻辑在 stage-contract.ts;这里是宿主与面板/助手共享的线上形状。
|
|
1167
|
+
*/
|
|
1168
|
+
export interface StageInfo {
|
|
1169
|
+
/** 阶段标识。 */
|
|
1170
|
+
id: 'outline' | 'bible' | 'plan' | 'write' | 'wait' | 'review' | 'revise' | 'export';
|
|
1171
|
+
/** 中文阶段名。 */
|
|
1172
|
+
label: string;
|
|
1173
|
+
/** 建议的下一步动作(助手工具名;无对应工具时为空数组)。 */
|
|
1174
|
+
recommend: string[];
|
|
1175
|
+
/** 本阶段允许的写操作(作者只说了「继续」时的唯一命令集)。 */
|
|
1176
|
+
allow: string[];
|
|
1177
|
+
/** 为什么处于该阶段。 */
|
|
1178
|
+
reason: string;
|
|
1179
|
+
}
|
|
723
1180
|
export interface StatusResponse {
|
|
724
1181
|
config: NovelConfig;
|
|
725
1182
|
/** The persisted project, when one exists in the output dir. */
|
|
726
1183
|
project?: ProjectState;
|
|
727
1184
|
/** Chapter files already on disk (basenames, sorted). */
|
|
728
1185
|
generatedFiles: string[];
|
|
1186
|
+
/** 全书质检实时状态(用于面板/外部读取进度)。 */
|
|
1187
|
+
audit?: AuditStatus;
|
|
1188
|
+
/** 宿主按项目真实状态算出的创作阶段(面板角标 / 外部自动化共用)。 */
|
|
1189
|
+
stage?: StageInfo;
|
|
1190
|
+
/**
|
|
1191
|
+
* 截断声明:本次响应中被裁掉的字段说明(如「编年录:共 320 条,仅返回最近 80 条」)。
|
|
1192
|
+
* 消费方不得把缺失字段当作"不存在",需要完整数据时走专用接口。
|
|
1193
|
+
*/
|
|
1194
|
+
truncations?: string[];
|
|
1195
|
+
}
|
|
1196
|
+
/** 生产单状态(生产单 = 区间批量生产执行器:计划补足 + 逐章生成 + 被拒分级处理)。 */
|
|
1197
|
+
export interface RunState {
|
|
1198
|
+
runId: string;
|
|
1199
|
+
/** 区间起点(含)。 */
|
|
1200
|
+
startNo: number;
|
|
1201
|
+
/** 区间终点(含)。 */
|
|
1202
|
+
endNo: number;
|
|
1203
|
+
status: 'running' | 'paused' | 'done' | 'stopped' | 'error';
|
|
1204
|
+
/** 当前处理到的章号(已 approved 的章会快进)。 */
|
|
1205
|
+
currentNo: number;
|
|
1206
|
+
stats: {
|
|
1207
|
+
/** 新生成(含审稿)的章数。 */
|
|
1208
|
+
generated: number;
|
|
1209
|
+
/** 被拒后按意见修订并通过的章数。 */
|
|
1210
|
+
revised: number;
|
|
1211
|
+
/** 被拒后豁免通过(无 high)的章数。 */
|
|
1212
|
+
exempted: number;
|
|
1213
|
+
/** error 后重新生成的章数。 */
|
|
1214
|
+
regenerated: number;
|
|
1215
|
+
/** 生成失败的章数。 */
|
|
1216
|
+
error: number;
|
|
1217
|
+
};
|
|
1218
|
+
/** 两轮修订仍不过、保留草稿待人工的章号。 */
|
|
1219
|
+
pendingManual: number[];
|
|
1220
|
+
/** 运行日志(保留最近 300 条)。 */
|
|
1221
|
+
log: Array<{
|
|
1222
|
+
at: string;
|
|
1223
|
+
text: string;
|
|
1224
|
+
}>;
|
|
1225
|
+
startedAt: string;
|
|
1226
|
+
updatedAt: string;
|
|
1227
|
+
error?: string;
|
|
1228
|
+
}
|
|
1229
|
+
/** POST /run/start request. */
|
|
1230
|
+
export interface RunStartRequest {
|
|
1231
|
+
/** 起始章号(默认 1)。 */
|
|
1232
|
+
startNo?: number;
|
|
1233
|
+
/** 结束章号(含;超出计划时自动补计划)。 */
|
|
1234
|
+
endNo?: number;
|
|
1235
|
+
/** 或指定新增章数(从当前最后一章 +1 起)。 */
|
|
1236
|
+
count?: number;
|
|
1237
|
+
}
|
|
1238
|
+
/** POST /run/control request. */
|
|
1239
|
+
export interface RunControlRequest {
|
|
1240
|
+
action: 'pause' | 'resume' | 'stop';
|
|
729
1241
|
}
|
|
730
1242
|
/** POST /load-outline request: either a docx path or raw text. */
|
|
731
1243
|
export interface LoadOutlineRequest {
|
|
@@ -794,6 +1306,7 @@ export type JobFrame = {
|
|
|
794
1306
|
file: string;
|
|
795
1307
|
chars: number;
|
|
796
1308
|
title: string;
|
|
1309
|
+
warn?: string;
|
|
797
1310
|
} | {
|
|
798
1311
|
type: 'review';
|
|
799
1312
|
no: number;
|
|
@@ -817,6 +1330,15 @@ export type JobFrame = {
|
|
|
817
1330
|
no: number;
|
|
818
1331
|
chars: number;
|
|
819
1332
|
draft: string;
|
|
1333
|
+
} | {
|
|
1334
|
+
type: 'outline-progress';
|
|
1335
|
+
done: number;
|
|
1336
|
+
total: number;
|
|
1337
|
+
phase: string;
|
|
1338
|
+
} | {
|
|
1339
|
+
type: 'outline-done';
|
|
1340
|
+
outline: string;
|
|
1341
|
+
chars: number;
|
|
820
1342
|
} | {
|
|
821
1343
|
type: 'error';
|
|
822
1344
|
no: number;
|
|
@@ -887,12 +1409,26 @@ export interface ConfigPatch {
|
|
|
887
1409
|
outputDir?: string;
|
|
888
1410
|
provider?: string;
|
|
889
1411
|
model?: string;
|
|
1412
|
+
generateModel?: string;
|
|
1413
|
+
reviewModel?: string;
|
|
1414
|
+
auditModel?: string;
|
|
1415
|
+
reasoningEffort?: 'off' | 'low' | 'high' | 'max';
|
|
1416
|
+
analysisReasoning?: 'off' | 'low' | 'high' | 'max';
|
|
890
1417
|
chapterChars?: number;
|
|
891
1418
|
maxTokens?: number;
|
|
892
1419
|
reviewPassScore?: number;
|
|
893
1420
|
autoReview?: boolean;
|
|
894
1421
|
autoAuthorReview?: boolean;
|
|
895
1422
|
autoReviewAfterRevise?: boolean;
|
|
1423
|
+
/** 自定义背景图(URL / dataURL / 服务端路径引用)。 */
|
|
1424
|
+
themeBackground?: string;
|
|
1425
|
+
/** 自定义背景遮罩/模糊强度 0-80。 */
|
|
1426
|
+
themeBackgroundBlur?: number;
|
|
1427
|
+
/** 玻璃透明度 0-100(100=当前原样)。 */
|
|
1428
|
+
themeOpacity?: number;
|
|
1429
|
+
enableAdaptMode?: boolean;
|
|
1430
|
+
/** 手动添加的模型库(完整替换保存)。 */
|
|
1431
|
+
savedModels?: SavedModel[];
|
|
896
1432
|
}
|
|
897
1433
|
/** One assistant conversation message (persisted per project). */
|
|
898
1434
|
export interface AssistantMessage {
|
|
@@ -923,6 +1459,12 @@ export type AssistantFrame = {
|
|
|
923
1459
|
type: 'toolDelta';
|
|
924
1460
|
name: string;
|
|
925
1461
|
text: string;
|
|
1462
|
+
}
|
|
1463
|
+
/** 工具完整结果(供前端渲染成结构化卡片,如拆书/导演)。 */
|
|
1464
|
+
| {
|
|
1465
|
+
type: 'toolResult';
|
|
1466
|
+
name: string;
|
|
1467
|
+
text: string;
|
|
926
1468
|
} | {
|
|
927
1469
|
type: 'done';
|
|
928
1470
|
} | {
|
|
@@ -935,15 +1477,21 @@ export interface AssistantHistoryResponse {
|
|
|
935
1477
|
}
|
|
936
1478
|
/** 题材基底库:一本书属于哪个阅读市场。树形(题材→子题材→下级)。 */
|
|
937
1479
|
export interface GenreNode {
|
|
1480
|
+
/** 稳定标识(内置库交叉引用)。 */
|
|
1481
|
+
id?: string;
|
|
938
1482
|
/** 题材名称(标签,如「仙侠修真」「都市异能」)。 */
|
|
939
1483
|
name: string;
|
|
940
1484
|
/** 题材特征、常见爽点、叙事重心或读者期待。 */
|
|
941
1485
|
description: string;
|
|
1486
|
+
/** 该题材的写法指引(开书定盘/卷计划用,区别于「读者期待」)。 */
|
|
1487
|
+
template?: string;
|
|
942
1488
|
/** 子题材。 */
|
|
943
1489
|
children: GenreNode[];
|
|
944
1490
|
}
|
|
945
1491
|
/** 推进模式库:读者为什么继续看下一章。 */
|
|
946
1492
|
export interface ProgressionMode {
|
|
1493
|
+
/** 稳定标识(与内置库交叉引用)。 */
|
|
1494
|
+
key?: string;
|
|
947
1495
|
/** 模式名称(如「升级变强」「经营扩张」「解谜揭露」)。 */
|
|
948
1496
|
name: string;
|
|
949
1497
|
/** 核心驱动力:靠什么制造追读动力。 */
|
|
@@ -956,11 +1504,33 @@ export interface ProgressionMode {
|
|
|
956
1504
|
risks: string[];
|
|
957
1505
|
/** 主模式或辅助模式。 */
|
|
958
1506
|
primary: boolean;
|
|
1507
|
+
/** 该模式的写法指引(开书定盘/卷计划用)。 */
|
|
1508
|
+
template?: string;
|
|
1509
|
+
/** 推进单位序列(每章如何推进,如「立威→打破质疑→扩大影响→碾压」)。 */
|
|
1510
|
+
progressionUnits?: string[];
|
|
1511
|
+
/** 允许出现的冲突形态。 */
|
|
1512
|
+
allowedConflictForms?: string[];
|
|
1513
|
+
/** 应避免的冲突形态(跑偏信号)。 */
|
|
1514
|
+
forbiddenConflictForms?: string[];
|
|
1515
|
+
/** 冲突烈度上限(low/medium/high),用于卷/章计划和审稿对齐。 */
|
|
1516
|
+
conflictCeiling?: 'low' | 'medium' | 'high';
|
|
1517
|
+
/** 单章推进单位说明。 */
|
|
1518
|
+
chapterUnit?: string;
|
|
1519
|
+
/** 卷末应兑现的回报。 */
|
|
1520
|
+
volumeReward?: string;
|
|
1521
|
+
/** 主驱动必须持续出现的信号(读者期待确认)。 */
|
|
1522
|
+
mandatorySignals?: string[];
|
|
1523
|
+
/** 反信号:出现即跑偏。 */
|
|
1524
|
+
antiSignals?: string[];
|
|
1525
|
+
/** 优先用的问题解决方式。 */
|
|
1526
|
+
resolutionStyle?: string;
|
|
959
1527
|
}
|
|
960
1528
|
/** 反 AI 规则:一条「要避免的问题 + 修正方向」。 */
|
|
961
1529
|
export interface AntiAiRule {
|
|
962
1530
|
/** 规则名(如「禁止解释型心理描写」「AI 高频套话」)。 */
|
|
963
1531
|
name: string;
|
|
1532
|
+
/** 稳定标识(与 defaultAntiAiRuleKeys 交叉引用;缺省用 name)。 */
|
|
1533
|
+
key?: string;
|
|
964
1534
|
/** 要避免的表达问题,具体可检查。 */
|
|
965
1535
|
avoid: string;
|
|
966
1536
|
/** 推荐修正方向。 */
|
|
@@ -969,8 +1539,55 @@ export interface AntiAiRule {
|
|
|
969
1539
|
detectPatterns?: string[];
|
|
970
1540
|
/** 是否内置全局规则(内置规则随插件发布,项目规则为用户自定义)。 */
|
|
971
1541
|
builtin?: boolean;
|
|
1542
|
+
/** 规则类别:forbidden=禁止类(命中即问题)/ risk=风险类(需注意但不硬伤)/ encourage=鼓励类(不命中不算错,只作建议)。 */
|
|
1543
|
+
severity?: 'forbidden' | 'risk' | 'encourage';
|
|
1544
|
+
/** 问题严重度(用于审稿优先级;缺省按类别推断)。 */
|
|
1545
|
+
riskLevel?: 'low' | 'medium' | 'high';
|
|
1546
|
+
/** 生成时直接注入的约束指令(缺失时回退到 avoid)。 */
|
|
1547
|
+
promptInstruction?: string;
|
|
1548
|
+
/** 是否允许自动改写(risk 类通常 false)。 */
|
|
1549
|
+
autoRewrite?: boolean;
|
|
1550
|
+
/** 是否为全局基线规则(新书默认启用,防止规则丢失后降级)。 */
|
|
1551
|
+
globalBaselineEnabled?: boolean;
|
|
1552
|
+
/** 是否启用(缺省 true)。 */
|
|
1553
|
+
enabled?: boolean;
|
|
1554
|
+
/** 作用域(缺省 all)。 */
|
|
1555
|
+
scope?: Array<'writing' | 'review' | 'polish' | 'all'>;
|
|
972
1556
|
}
|
|
973
1557
|
/** 预置写法模板(来自 AI-Novel-Writing-Assistant 内置数据,一键绑定无需样本文本)。 */
|
|
1558
|
+
export interface StyleTemplateNarrativeRules {
|
|
1559
|
+
progressionMode?: string;
|
|
1560
|
+
sceneUnitPattern?: string[];
|
|
1561
|
+
multiPov?: boolean;
|
|
1562
|
+
looping?: boolean;
|
|
1563
|
+
endingStyle?: string;
|
|
1564
|
+
povSwitchStyle?: string;
|
|
1565
|
+
summary?: string;
|
|
1566
|
+
}
|
|
1567
|
+
export interface StyleTemplateCharacterRules {
|
|
1568
|
+
allowSelfReflection?: boolean;
|
|
1569
|
+
emotionExpression?: string;
|
|
1570
|
+
defenseMechanisms?: string[];
|
|
1571
|
+
facePriority?: boolean;
|
|
1572
|
+
dialogueStyle?: string;
|
|
1573
|
+
summary?: string;
|
|
1574
|
+
}
|
|
1575
|
+
export interface StyleTemplateLanguageRules {
|
|
1576
|
+
register?: string;
|
|
1577
|
+
roughness?: number;
|
|
1578
|
+
allowIncompleteSentences?: boolean;
|
|
1579
|
+
allowSwearing?: boolean;
|
|
1580
|
+
sentenceVariation?: string;
|
|
1581
|
+
allowUselessDetails?: boolean;
|
|
1582
|
+
summary?: string;
|
|
1583
|
+
}
|
|
1584
|
+
export interface StyleTemplateRhythmRules {
|
|
1585
|
+
pace?: string;
|
|
1586
|
+
paragraphDensity?: string;
|
|
1587
|
+
allowFragmentedFlow?: boolean;
|
|
1588
|
+
actionOverExplanation?: boolean;
|
|
1589
|
+
summary?: string;
|
|
1590
|
+
}
|
|
974
1591
|
export interface StyleTemplate {
|
|
975
1592
|
/** 模板 key(如 power-up-escalation)。 */
|
|
976
1593
|
key: string;
|
|
@@ -982,17 +1599,63 @@ export interface StyleTemplate {
|
|
|
982
1599
|
category: string;
|
|
983
1600
|
/** 适用题材。 */
|
|
984
1601
|
applicableGenres: string[];
|
|
985
|
-
/**
|
|
1602
|
+
/** 标签(便于筛选)。 */
|
|
1603
|
+
tags?: string[];
|
|
1604
|
+
/** 一句话分析(模板定位说明)。 */
|
|
1605
|
+
analysisMarkdown?: string;
|
|
1606
|
+
/** 叙述规则(结构化)。 */
|
|
1607
|
+
narrative?: StyleTemplateNarrativeRules;
|
|
1608
|
+
/** 角色规则(结构化)。 */
|
|
1609
|
+
character?: StyleTemplateCharacterRules;
|
|
1610
|
+
/** 语言规则(结构化)。 */
|
|
1611
|
+
language?: StyleTemplateLanguageRules;
|
|
1612
|
+
/** 节奏规则(结构化)。 */
|
|
1613
|
+
rhythm?: StyleTemplateRhythmRules;
|
|
1614
|
+
/** 叙述规则(扁平,兼容旧数据)。 */
|
|
986
1615
|
proseRules: string[];
|
|
987
|
-
/**
|
|
1616
|
+
/** 角色/台词规则(扁平,兼容旧数据)。 */
|
|
988
1617
|
dialogueRules: string[];
|
|
989
|
-
/**
|
|
1618
|
+
/** 语言规则(扁平,兼容旧数据)。 */
|
|
990
1619
|
languageRules: string[];
|
|
991
|
-
/**
|
|
1620
|
+
/** 节奏规则(扁平,兼容旧数据)。 */
|
|
992
1621
|
rhythmRules: string[];
|
|
993
1622
|
/** 该模板默认绑定的反 AI 规则 key(内置规则名)。 */
|
|
994
1623
|
defaultAntiAiRuleKeys: string[];
|
|
995
1624
|
}
|
|
1625
|
+
/** 起始风格画像:无样本文本也能快速绑定一套写法(对齐上游 DEFAULT_STARTER_STYLE_PROFILES)。 */
|
|
1626
|
+
export interface StarterStyleProfile {
|
|
1627
|
+
/** stable key(如 starter-power-up)。 */
|
|
1628
|
+
key: string;
|
|
1629
|
+
/** 绑定到的写法模板 key。 */
|
|
1630
|
+
templateKey: string;
|
|
1631
|
+
/** 画像名。 */
|
|
1632
|
+
name: string;
|
|
1633
|
+
/** 画像说明。 */
|
|
1634
|
+
description: string;
|
|
1635
|
+
}
|
|
1636
|
+
/** 剧情桥段库:可复用的情节套路/桥段(作者阅读经验沉淀,与书内 Plotline 不同层)。 */
|
|
1637
|
+
export interface PlotBeatTemplate {
|
|
1638
|
+
/** 模板 key(如 face-slap / exit-wedding)。 */
|
|
1639
|
+
key: string;
|
|
1640
|
+
/** 桥段名(如「打脸」「退婚」)。 */
|
|
1641
|
+
name: string;
|
|
1642
|
+
/** 分类(如「装逼打脸」「身份逆袭」)。 */
|
|
1643
|
+
category: string;
|
|
1644
|
+
/** 一句话说明。 */
|
|
1645
|
+
summary: string;
|
|
1646
|
+
/** 适用位置(开局/前期/中期/后期/高潮/结尾)。 */
|
|
1647
|
+
position: string;
|
|
1648
|
+
/** 前置条件。 */
|
|
1649
|
+
preconditions: string[];
|
|
1650
|
+
/** 爽点来源。 */
|
|
1651
|
+
payoffSource: string[];
|
|
1652
|
+
/** 常用组合(可搭配的桥段)。 */
|
|
1653
|
+
combos: string[];
|
|
1654
|
+
/** 禁忌(别用烂/别用死)。 */
|
|
1655
|
+
taboos: string[];
|
|
1656
|
+
/** 适用题材。 */
|
|
1657
|
+
applicableGenres: string[];
|
|
1658
|
+
}
|
|
996
1659
|
/** 写法引擎:从样本文本提取的叙事风格资产。 */
|
|
997
1660
|
export interface StyleAsset {
|
|
998
1661
|
/** 资产名(如「林越式痞坏」「冷峻猎手风」)。 */
|
|
@@ -1007,6 +1670,31 @@ export interface StyleAsset {
|
|
|
1007
1670
|
boundaries: string[];
|
|
1008
1671
|
/** 来源样本文本(可空)。 */
|
|
1009
1672
|
sourceText?: string;
|
|
1673
|
+
/** 仿写预设:imitate=高保真仿写 / balanced=平衡 / transfer=迁移(去指纹)。 */
|
|
1674
|
+
preset?: 'imitate' | 'balanced' | 'transfer';
|
|
1675
|
+
/** 指纹风险:仿写时照搬原作独特表达的风险。 */
|
|
1676
|
+
fingerprintRisk?: 'low' | 'medium' | 'high';
|
|
1677
|
+
/** 净化后的写作指引(可安全用于生成,去掉了会暴露来源的具体细节)。 */
|
|
1678
|
+
writingGuidance?: string[];
|
|
1679
|
+
/** 禁止照搬的原作特有实体(人名/地名/核心设定句式),生成时需避开。 */
|
|
1680
|
+
forbiddenEntities?: string[];
|
|
1681
|
+
/** 创建时间。 */
|
|
1682
|
+
createdAt: string;
|
|
1683
|
+
}
|
|
1684
|
+
/** 写作公式(从样本文本分层提取的"这套文怎么写"浓缩,供生成/改写复用)。 */
|
|
1685
|
+
export interface StyleFormula {
|
|
1686
|
+
/** 稳定 key。 */
|
|
1687
|
+
key: string;
|
|
1688
|
+
/** 公式名。 */
|
|
1689
|
+
name: string;
|
|
1690
|
+
/** 提取深度:basic=骨架 / standard=完整 / deep=逐句细化。 */
|
|
1691
|
+
depth: 'basic' | 'standard' | 'deep';
|
|
1692
|
+
/** 重点聚焦域(如 开场/对话/节奏/爽点密度)。 */
|
|
1693
|
+
focusAreas: string[];
|
|
1694
|
+
/** 公式正文(Markdown)。 */
|
|
1695
|
+
formula: string;
|
|
1696
|
+
/** 应用指引(生成/改写时如何套用)。 */
|
|
1697
|
+
applyGuidance: string;
|
|
1010
1698
|
/** 创建时间。 */
|
|
1011
1699
|
createdAt: string;
|
|
1012
1700
|
}
|
|
@@ -1022,6 +1710,8 @@ export interface ProjectAssets {
|
|
|
1022
1710
|
antiAiRules: AntiAiRule[];
|
|
1023
1711
|
/** 绑定的写法资产。 */
|
|
1024
1712
|
styleAssets: StyleAsset[];
|
|
1713
|
+
/** 写作公式(分层提取:basic/standard/deep)。 */
|
|
1714
|
+
styleFormulas?: StyleFormula[];
|
|
1025
1715
|
/** 资产更新时间。 */
|
|
1026
1716
|
updatedAt?: string;
|
|
1027
1717
|
}
|
|
@@ -1036,6 +1726,10 @@ export interface AssetsResponse {
|
|
|
1036
1726
|
styleTemplates: StyleTemplate[];
|
|
1037
1727
|
/** 内置推进模式候选。 */
|
|
1038
1728
|
progressionLibrary: ProgressionMode[];
|
|
1729
|
+
/** 起始风格画像(无样本文本快速绑定写法)。 */
|
|
1730
|
+
starterStyleProfiles: StarterStyleProfile[];
|
|
1731
|
+
/** 内置剧情桥段库(可复用套路)。 */
|
|
1732
|
+
plotBeatLibrary: PlotBeatTemplate[];
|
|
1039
1733
|
}
|
|
1040
1734
|
/** POST /assets request:更新项目写作资产(部分字段可选)。 */
|
|
1041
1735
|
export interface AssetsPatch {
|
|
@@ -1044,6 +1738,7 @@ export interface AssetsPatch {
|
|
|
1044
1738
|
auxiliaryProgressions?: ProgressionMode[];
|
|
1045
1739
|
antiAiRules?: AntiAiRule[];
|
|
1046
1740
|
styleAssets?: StyleAsset[];
|
|
1741
|
+
styleFormulas?: StyleFormula[];
|
|
1047
1742
|
}
|
|
1048
1743
|
/** POST /style-engine request:从样本文本提取写法资产。 */
|
|
1049
1744
|
export interface StyleEngineRequest {
|
|
@@ -1052,3 +1747,291 @@ export interface StyleEngineRequest {
|
|
|
1052
1747
|
/** 资产名(可选,默认「风格资产 N」)。 */
|
|
1053
1748
|
name?: string;
|
|
1054
1749
|
}
|
|
1750
|
+
/** 作者资产库中一条可跨书复用的资产(笔法/红线/套路/角色模板/世界观模板等)。 */
|
|
1751
|
+
export interface AuthorStyleAsset {
|
|
1752
|
+
/** 稳定 id(本地唯一)。 */
|
|
1753
|
+
id: string;
|
|
1754
|
+
/** 资产名(如「短句快节奏爽文风」「林越式痞坏角色」)。 */
|
|
1755
|
+
name: string;
|
|
1756
|
+
/** 资产类型。 */
|
|
1757
|
+
kind: 'style' | 'antiAi' | 'progression' | 'genre' | 'roleTemplate' | 'worldTemplate' | 'plotBeat' | 'custom';
|
|
1758
|
+
/** 一句话摘要。 */
|
|
1759
|
+
summary: string;
|
|
1760
|
+
/** 资产正文内容(按 kind 约定解读的文本/JSON 描述)。 */
|
|
1761
|
+
content: string;
|
|
1762
|
+
/** 结构化载荷(角色模板/世界观模板等可结构化字段;缺省为 null)。 */
|
|
1763
|
+
structured?: Record<string, unknown>;
|
|
1764
|
+
/** 来源书名(哪本书提炼/收藏而来)。 */
|
|
1765
|
+
sourceBooks: string[];
|
|
1766
|
+
/** 标签。 */
|
|
1767
|
+
tags: string[];
|
|
1768
|
+
/** 来源样本文本(可选)。 */
|
|
1769
|
+
sourceText?: string;
|
|
1770
|
+
/** 创建时间。 */
|
|
1771
|
+
createdAt: string;
|
|
1772
|
+
/** 更新时间。 */
|
|
1773
|
+
updatedAt: string;
|
|
1774
|
+
}
|
|
1775
|
+
/** 作者资产库(跨书总数据):按作者维度聚合的可复用资产。 */
|
|
1776
|
+
export interface AuthorAssetLibrary {
|
|
1777
|
+
/** 货架版本,便于未来迁移。 */
|
|
1778
|
+
version: 1;
|
|
1779
|
+
items: AuthorStyleAsset[];
|
|
1780
|
+
}
|
|
1781
|
+
/** GET /author-assets 响应。 */
|
|
1782
|
+
export interface AuthorAssetsResponse {
|
|
1783
|
+
assets: AuthorAssetLibrary;
|
|
1784
|
+
}
|
|
1785
|
+
/** POST /author-assets/upsert 请求:新增或按 id 更新一条资产。 */
|
|
1786
|
+
export interface AuthorAssetUpsertRequest {
|
|
1787
|
+
asset: AuthorStyleAsset;
|
|
1788
|
+
}
|
|
1789
|
+
/** POST /author-assets/remove 请求:删除一条资产。 */
|
|
1790
|
+
export interface AuthorAssetRemoveRequest {
|
|
1791
|
+
id: string;
|
|
1792
|
+
}
|
|
1793
|
+
/** 改编可改范围的单个维度(矩阵的一行)。 */
|
|
1794
|
+
export interface AdaptationDimension {
|
|
1795
|
+
/** 维度 key(如 realm/name/goldenFinger…)。 */
|
|
1796
|
+
key: string;
|
|
1797
|
+
/** 维度名(如「大世界」「修为体系」「主角名」「金手指」)。 */
|
|
1798
|
+
title: string;
|
|
1799
|
+
/** 可改度:保留 / 可改影响大 / 可改影响小 / 可自由改 / 仅视觉包装。 */
|
|
1800
|
+
mutability: 'locked' | 'big' | 'small' | 'free' | 'visual';
|
|
1801
|
+
/** 原文当前值(从正文提炼,附证据)。 */
|
|
1802
|
+
current: string;
|
|
1803
|
+
/** 该值在正文中的出现证据(章节/频次,可空)。 */
|
|
1804
|
+
evidence?: string;
|
|
1805
|
+
/** 建议的候选新值(可空,每套含名称与一句话说明)。 */
|
|
1806
|
+
candidates?: Array<{
|
|
1807
|
+
name: string;
|
|
1808
|
+
desc?: string;
|
|
1809
|
+
}>;
|
|
1810
|
+
/** 联动影响说明(改了会影响哪些章节/角色/伏笔/术语)。 */
|
|
1811
|
+
impact: string;
|
|
1812
|
+
/** 风险评级。 */
|
|
1813
|
+
risk: 'high' | 'medium' | 'low';
|
|
1814
|
+
}
|
|
1815
|
+
/** POST /adapt/analyze 请求:上传全文做改编分析。 */
|
|
1816
|
+
export interface AdaptAnalyzeRequest {
|
|
1817
|
+
/** 全文文本(优先)。 */
|
|
1818
|
+
text: string;
|
|
1819
|
+
/** 或服务器端全文文件路径。 */
|
|
1820
|
+
filePath?: string;
|
|
1821
|
+
}
|
|
1822
|
+
/** POST /adapt/analyze 响应。 */
|
|
1823
|
+
export interface AdaptAnalyzeResponse {
|
|
1824
|
+
/** 识别书名(文件名推断或正文首行)。 */
|
|
1825
|
+
bookName: string;
|
|
1826
|
+
/** 拆出的章节数。 */
|
|
1827
|
+
chapters: number;
|
|
1828
|
+
/** 反推的初始大纲(可空)。 */
|
|
1829
|
+
outline?: string;
|
|
1830
|
+
/** 可改范围矩阵。 */
|
|
1831
|
+
dimensions: AdaptationDimension[];
|
|
1832
|
+
/** 分析消耗说明。 */
|
|
1833
|
+
note?: string;
|
|
1834
|
+
}
|
|
1835
|
+
/** 一条改编映射(原值 → 新值)。 */
|
|
1836
|
+
export interface AdaptationMapping {
|
|
1837
|
+
/** 原值(如「林尘」「练气」「青云宗」)。 */
|
|
1838
|
+
source: string;
|
|
1839
|
+
/** 新值(如「楚风」「凝元」「天渊阁」)。 */
|
|
1840
|
+
target: string;
|
|
1841
|
+
/** 适用范围。 */
|
|
1842
|
+
scope: 'name' | 'realm' | 'faction' | 'term' | 'other';
|
|
1843
|
+
/** 说明(可空)。 */
|
|
1844
|
+
note?: string;
|
|
1845
|
+
}
|
|
1846
|
+
/** 改编规则:哪些必须保留、哪些允许改、一致性约束。 */
|
|
1847
|
+
export interface AdaptationRules {
|
|
1848
|
+
/** 必须保留的要素(骨架/人物动机/伏笔逻辑/爽点结构…)。 */
|
|
1849
|
+
preserve: string[];
|
|
1850
|
+
/** 允许改变的要素。 */
|
|
1851
|
+
change: string[];
|
|
1852
|
+
/** 改编红线/一致性要求。 */
|
|
1853
|
+
constraints: string[];
|
|
1854
|
+
}
|
|
1855
|
+
/** 一组改编方案(映射表 + 规则 + 联动影响清单)。 */
|
|
1856
|
+
export interface AdaptationProposal {
|
|
1857
|
+
/** 映射表(原→新)。 */
|
|
1858
|
+
mappings: AdaptationMapping[];
|
|
1859
|
+
/** 改编规则。 */
|
|
1860
|
+
rules: AdaptationRules;
|
|
1861
|
+
/** 联动影响清单。 */
|
|
1862
|
+
impacts: Array<{
|
|
1863
|
+
item: string;
|
|
1864
|
+
detail: string;
|
|
1865
|
+
risk: 'high' | 'medium' | 'low';
|
|
1866
|
+
chapters?: number[];
|
|
1867
|
+
}>;
|
|
1868
|
+
}
|
|
1869
|
+
/** POST /adapt/propose 请求:由用户勾选的维度 + 新值生成改编方案。 */
|
|
1870
|
+
export interface AdaptProposeRequest {
|
|
1871
|
+
/** 原文全文(复用,便于 LLM 核对联动影响)。 */
|
|
1872
|
+
text: string;
|
|
1873
|
+
/** 用户确认要改的维度(含原值与新值)。 */
|
|
1874
|
+
selections: Array<{
|
|
1875
|
+
key: string;
|
|
1876
|
+
title: string;
|
|
1877
|
+
current: string;
|
|
1878
|
+
target: string;
|
|
1879
|
+
mutability: string;
|
|
1880
|
+
}>;
|
|
1881
|
+
/** 若已分析过,可携带完整矩阵作为上下文。 */
|
|
1882
|
+
dimensions?: AdaptationDimension[];
|
|
1883
|
+
}
|
|
1884
|
+
/** POST /adapt/propose 响应。 */
|
|
1885
|
+
export interface AdaptProposeResponse {
|
|
1886
|
+
proposal: AdaptationProposal;
|
|
1887
|
+
}
|
|
1888
|
+
/** POST /adapt/execute 请求:执行改编(replace=术语替换;rewrite=逐章 LLM 重写)。 */
|
|
1889
|
+
export interface AdaptExecuteRequest {
|
|
1890
|
+
/** 原文全文。 */
|
|
1891
|
+
text: string;
|
|
1892
|
+
/** 改编映射表。 */
|
|
1893
|
+
mappings: AdaptationMapping[];
|
|
1894
|
+
/** 改编规则(rewrite 模式生效:保留/允许变/红线)。 */
|
|
1895
|
+
rules?: AdaptationRules;
|
|
1896
|
+
/** 执行模式:replace(术语替换)或 rewrite(逐章重写)。 */
|
|
1897
|
+
mode?: 'replace' | 'rewrite';
|
|
1898
|
+
/** rewrite 模式:只重写前 N 章(0/缺省 = 全部,且在 startNo/endNo 窗口内)。 */
|
|
1899
|
+
maxChapters?: number;
|
|
1900
|
+
/** rewrite 模式:起始章号(含,默认 1)。 */
|
|
1901
|
+
startNo?: number;
|
|
1902
|
+
/** rewrite 模式:结束章号(含;0/缺省 = 到全书末尾)。 */
|
|
1903
|
+
endNo?: number;
|
|
1904
|
+
}
|
|
1905
|
+
/** POST /adapt/execute 响应。 */
|
|
1906
|
+
export interface AdaptExecuteResponse {
|
|
1907
|
+
/** 改编后的全文。 */
|
|
1908
|
+
adaptedText: string;
|
|
1909
|
+
/** 执行的映射数。 */
|
|
1910
|
+
mappings: number;
|
|
1911
|
+
/** 命中统计:每条映射的替换次数。 */
|
|
1912
|
+
hits: Array<{
|
|
1913
|
+
source: string;
|
|
1914
|
+
target: string;
|
|
1915
|
+
count: number;
|
|
1916
|
+
}>;
|
|
1917
|
+
/** 执行模式(replace / rewrite)。 */
|
|
1918
|
+
mode?: 'replace' | 'rewrite';
|
|
1919
|
+
/** rewrite 模式的逐章结果(no/title/chars)。 */
|
|
1920
|
+
rewritten?: Array<{
|
|
1921
|
+
no: number;
|
|
1922
|
+
title: string;
|
|
1923
|
+
chars: number;
|
|
1924
|
+
}>;
|
|
1925
|
+
/** rewrite 模式下重写失败、保留原章的章节号。 */
|
|
1926
|
+
skipped?: number[];
|
|
1927
|
+
}
|
|
1928
|
+
/** POST /adapt/rewrite-stream 的 NDJSON 帧(逐章进度 + 结束结果)。 */
|
|
1929
|
+
export type AdaptRewriteFrame = {
|
|
1930
|
+
type: 'progress';
|
|
1931
|
+
completed: number;
|
|
1932
|
+
total: number;
|
|
1933
|
+
no: number;
|
|
1934
|
+
title: string;
|
|
1935
|
+
} | {
|
|
1936
|
+
type: 'done';
|
|
1937
|
+
result: AdaptExecuteResponse;
|
|
1938
|
+
} | {
|
|
1939
|
+
type: 'error';
|
|
1940
|
+
message: string;
|
|
1941
|
+
};
|
|
1942
|
+
/** POST /adapt/save 请求:保存改编全文为新书(原书保留,登记书架)。 */
|
|
1943
|
+
export interface AdaptSaveRequest {
|
|
1944
|
+
/** 改编后的全文。 */
|
|
1945
|
+
text: string;
|
|
1946
|
+
/** 新书名(缺省为「改编新书」;建议用「<原著>·改编版」)。 */
|
|
1947
|
+
bookName?: string;
|
|
1948
|
+
/** 新书输出目录(缺省 ~/.dsh/novels/书名)。 */
|
|
1949
|
+
outputDir?: string;
|
|
1950
|
+
/** 可附带反推大纲(写进新项目,便于后续续写/编辑)。 */
|
|
1951
|
+
outline?: string;
|
|
1952
|
+
}
|
|
1953
|
+
/** POST /adapt/save 响应。 */
|
|
1954
|
+
export interface AdaptSaveResponse {
|
|
1955
|
+
/** 登记后的书架条目。 */
|
|
1956
|
+
book: BookEntry;
|
|
1957
|
+
/** 新书名。 */
|
|
1958
|
+
bookName: string;
|
|
1959
|
+
/** 成功拆出的章节数。 */
|
|
1960
|
+
chapters: number;
|
|
1961
|
+
/** 因内容过短被跳过的章节标题列表。 */
|
|
1962
|
+
skipped: string[];
|
|
1963
|
+
/** 新书输出目录。 */
|
|
1964
|
+
outputDir: string;
|
|
1965
|
+
}
|
|
1966
|
+
/** POST /adapt/materialize 请求:从源全文 + 用户编辑后的改编方案,提炼新书资料并保存为「待写新书」。 */
|
|
1967
|
+
export interface AdaptMaterializeRequest {
|
|
1968
|
+
/** 源书全文。 */
|
|
1969
|
+
text: string;
|
|
1970
|
+
/** 新书名(缺省为「<源书名>·改编版」)。 */
|
|
1971
|
+
bookName?: string;
|
|
1972
|
+
/** 新书输出目录(缺省 ~/.dsh/novels/书名)。 */
|
|
1973
|
+
outputDir?: string;
|
|
1974
|
+
/** 反推大纲(来自分析;缺少时用源文章题兜底)。 */
|
|
1975
|
+
outline?: string;
|
|
1976
|
+
/** 用户编辑后的改编方案(映射表 + 规则)。 */
|
|
1977
|
+
proposal: AdaptationProposal;
|
|
1978
|
+
/** 拟规划章节数(缺省 30,可在前端调整)。 */
|
|
1979
|
+
chapterCount?: number;
|
|
1980
|
+
}
|
|
1981
|
+
/** POST /adapt/materialize 响应:提炼后的新书资料(预览,尚未落盘;保存走 /adapt/materialize-save)。 */
|
|
1982
|
+
export interface AdaptMaterializeResponse {
|
|
1983
|
+
/** 书架条目(仅在已保存时存在;预览阶段为 undefined)。 */
|
|
1984
|
+
book?: BookEntry;
|
|
1985
|
+
/** 新书名。 */
|
|
1986
|
+
bookName: string;
|
|
1987
|
+
/** 改编后总纲。 */
|
|
1988
|
+
outline: string;
|
|
1989
|
+
/** 改编后道藏。 */
|
|
1990
|
+
bible: StoryBible;
|
|
1991
|
+
/** 改编后角色库。 */
|
|
1992
|
+
roles: RoleRecord[];
|
|
1993
|
+
/** 改编后大世界。 */
|
|
1994
|
+
world: WorldState;
|
|
1995
|
+
/** 改编后卷计划。 */
|
|
1996
|
+
volumes: Volume[];
|
|
1997
|
+
/** 改编后章节计划(status=pending)。 */
|
|
1998
|
+
chapters: ChapterPlan[];
|
|
1999
|
+
/** 新书输出目录。 */
|
|
2000
|
+
outputDir: string;
|
|
2001
|
+
}
|
|
2002
|
+
/** POST /adapt/materialize-save 请求:把预览/微调后的新书资料写入并登记书架。 */
|
|
2003
|
+
export interface AdaptMaterializeSaveRequest {
|
|
2004
|
+
/** 新书名(缺省为「改编版」)。 */
|
|
2005
|
+
bookName?: string;
|
|
2006
|
+
/** 新书输出目录(缺省 ~/.dsh/novels/书名)。 */
|
|
2007
|
+
outputDir?: string;
|
|
2008
|
+
/** 改编后总纲。 */
|
|
2009
|
+
outline: string;
|
|
2010
|
+
/** 改编后道藏。 */
|
|
2011
|
+
bible: StoryBible;
|
|
2012
|
+
/** 改编后角色库。 */
|
|
2013
|
+
roles: RoleRecord[];
|
|
2014
|
+
/** 改编后大世界。 */
|
|
2015
|
+
world: WorldState;
|
|
2016
|
+
/** 改编后卷计划。 */
|
|
2017
|
+
volumes: Volume[];
|
|
2018
|
+
/** 改编后章节计划(status=pending)。 */
|
|
2019
|
+
chapters: ChapterPlan[];
|
|
2020
|
+
}
|
|
2021
|
+
/** POST /adapt/materialize-save 响应。 */
|
|
2022
|
+
export interface AdaptMaterializeSaveResponse {
|
|
2023
|
+
/** 登记后的书架条目。 */
|
|
2024
|
+
book: BookEntry;
|
|
2025
|
+
/** 新书名。 */
|
|
2026
|
+
bookName: string;
|
|
2027
|
+
/** 成功写入的章节数。 */
|
|
2028
|
+
chapters: number;
|
|
2029
|
+
/** 新书输出目录。 */
|
|
2030
|
+
outputDir: string;
|
|
2031
|
+
}
|
|
2032
|
+
/** POST /plugin/update 响应:插件自更新结果。 */
|
|
2033
|
+
export interface PluginUpdateResponse {
|
|
2034
|
+
ok: boolean;
|
|
2035
|
+
/** 更新结果说明(成功/失败/环境提示)。 */
|
|
2036
|
+
message: string;
|
|
2037
|
+
}
|