@waterwx/dsh-novel-forge 2.1.2-alpha → 2.1.3

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.
Files changed (254) hide show
  1. package/README.md +278 -368
  2. package/lib/client.js +19568 -21381
  3. package/lib/index.js +5158 -3958
  4. package/lib/types/action-guard.d.ts +61 -0
  5. package/lib/types/ai-scan.d.ts +80 -12
  6. package/lib/types/assets.d.ts +7 -9
  7. package/lib/types/assistant.d.ts +25 -0
  8. package/lib/types/author-assets.d.ts +1 -3
  9. package/lib/types/bookshelf.d.ts +13 -3
  10. package/lib/types/client/api.d.ts +49 -29
  11. package/lib/types/client/chip-prefs.d.ts +36 -0
  12. package/lib/types/client/docx.d.ts +2 -2
  13. package/lib/types/client/llmLive.d.ts +12 -14
  14. package/lib/types/client/locales.d.ts +12 -67
  15. package/lib/types/client/mount.d.ts +0 -2
  16. package/lib/types/client/panel/AdaptModeView.d.ts +1 -1
  17. package/lib/types/client/panel/AiTag.d.ts +1 -0
  18. package/lib/types/client/panel/AssetsTab.d.ts +1 -1
  19. package/lib/types/client/panel/AssistantTab.d.ts +4 -1
  20. package/lib/types/client/panel/AuthorAssetsView.d.ts +1 -1
  21. package/lib/types/client/panel/AuthorHome.d.ts +12 -12
  22. package/lib/types/client/panel/CmdPalette.d.ts +12 -0
  23. package/lib/types/client/panel/CreateBookView.d.ts +1 -1
  24. package/lib/types/client/panel/GlobalAssetLibraryView.d.ts +1 -1
  25. package/lib/types/client/panel/ImportModal.d.ts +1 -1
  26. package/lib/types/client/panel/LiveFeedLog.d.ts +8 -0
  27. package/lib/types/client/panel/ModelManager.d.ts +2 -2
  28. package/lib/types/client/panel/NovelPanel.d.ts +7 -2
  29. package/lib/types/client/panel/PageHeader.d.ts +18 -0
  30. package/lib/types/client/panel/ProgressConsole.d.ts +1 -1
  31. package/lib/types/client/panel/PromptSlotsView.d.ts +11 -0
  32. package/lib/types/client/panel/ReaderView.d.ts +1 -1
  33. package/lib/types/client/panel/RunPanel.d.ts +1 -1
  34. package/lib/types/client/panel/SettingsView.d.ts +13 -10
  35. package/lib/types/client/panel/ShelfView.d.ts +11 -2
  36. package/lib/types/client/panel/SubPage.d.ts +27 -0
  37. package/lib/types/client/panel/TensionView.d.ts +18 -0
  38. package/lib/types/client/panel/TimelineView.d.ts +18 -0
  39. package/lib/types/client/panel/WorldTab.d.ts +1 -1
  40. package/lib/types/client/panel/helpers.d.ts +5 -3
  41. package/lib/types/client/panel/market-radar-state.d.ts +56 -0
  42. package/lib/types/client/panel/outline-markdown.d.ts +112 -0
  43. package/lib/types/client/panel/status-badge.d.ts +13 -0
  44. package/lib/types/client/panel/storage-parse.d.ts +46 -0
  45. package/lib/types/client/panel/toast.d.ts +2 -0
  46. package/lib/types/client/panel/usePersistentState.d.ts +17 -0
  47. package/lib/types/client/panel/views.d.ts +21 -35
  48. package/lib/types/client/run-status.d.ts +21 -0
  49. package/lib/types/client/sidebar-entry.d.ts +0 -2
  50. package/lib/types/digest-parse.d.ts +29 -0
  51. package/lib/types/docx-core.d.ts +16 -0
  52. package/lib/types/docx.d.ts +2 -3
  53. package/lib/types/engine.d.ts +122 -103
  54. package/lib/types/home.d.ts +11 -0
  55. package/lib/types/index.d.ts +21 -13
  56. package/lib/types/llm-live.d.ts +62 -36
  57. package/lib/types/llm-retry.d.ts +38 -0
  58. package/lib/types/market-radar-scan.d.ts +0 -1
  59. package/lib/types/market-radar-sources.d.ts +1 -1
  60. package/lib/types/migrate-output.d.ts +25 -0
  61. package/lib/types/model-capability.d.ts +119 -0
  62. package/lib/types/model-request.d.ts +36 -0
  63. package/lib/types/output-budget.d.ts +86 -0
  64. package/lib/types/plotline-align.d.ts +35 -0
  65. package/lib/types/prompt-slots.d.ts +57 -0
  66. package/lib/types/prompting.d.ts +2 -27
  67. package/lib/types/protocol.d.ts +479 -595
  68. package/lib/types/revision.d.ts +76 -0
  69. package/lib/types/routes.d.ts +9 -3
  70. package/lib/types/run-selection.d.ts +51 -0
  71. package/lib/types/run.d.ts +31 -0
  72. package/lib/types/settings-persist.d.ts +59 -0
  73. package/lib/types/snapshots.d.ts +46 -0
  74. package/lib/types/stage-contract.d.ts +58 -0
  75. package/lib/types/stream-fallback.d.ts +60 -0
  76. package/lib/types/strip-headings.d.ts +33 -0
  77. package/lib/types/style-fingerprint.d.ts +78 -0
  78. package/lib/types/tension.d.ts +53 -0
  79. package/lib/types/timeline.d.ts +37 -0
  80. package/package.json +41 -28
  81. package/assets/styles/arcane-thick-3d.webp +0 -0
  82. package/assets/styles/chinese-ink.webp +0 -0
  83. package/assets/styles/clay-stopmotion-3d.webp +0 -0
  84. package/assets/styles/dark-ghibli.webp +0 -0
  85. package/assets/styles/dark-gothic-3d.webp +0 -0
  86. package/assets/styles/film-photo.webp +0 -0
  87. package/assets/styles/guofeng-heavy.webp +0 -0
  88. package/assets/styles/guoman-2d-gufeng.webp +0 -0
  89. package/assets/styles/guoman-3d-tianyuan.webp +0 -0
  90. package/assets/styles/guoman-3d-xuanhuan.webp +0 -0
  91. package/assets/styles/horror-game-3d.webp +0 -0
  92. package/assets/styles/hyperreal-3d.webp +0 -0
  93. package/assets/styles/japan-cel-dark.webp +0 -0
  94. package/assets/styles/korean-webtoon.webp +0 -0
  95. package/assets/styles/low-cyberpunk-3d.webp +0 -0
  96. package/assets/styles/nextgen-cg.webp +0 -0
  97. package/assets/styles/noir-film.webp +0 -0
  98. package/assets/styles/openworld-survival.webp +0 -0
  99. package/assets/styles/paper-cut-3d.webp +0 -0
  100. package/assets/styles/pixar-adult-3d.webp +0 -0
  101. package/assets/styles/pop-marvel-2d.webp +0 -0
  102. package/assets/styles/sandiao-qban.webp +0 -0
  103. package/assets/styles/shinkai-anime.webp +0 -0
  104. package/assets/styles/tactical-stealth.webp +0 -0
  105. package/assets/styles/urban-lightreal-3d.webp +0 -0
  106. package/assets/styles/vaporwave-3d.webp +0 -0
  107. package/assets/styles/vhs90.webp +0 -0
  108. package/lib/types/client/panel/BookshelfBar.d.ts +0 -11
  109. package/lib/types/client/panel/FlowGuide.d.ts +0 -22
  110. package/lib/types/client/panel/MangaRoleLibrary.d.ts +0 -20
  111. package/lib/types/client/panel/MangaWorkspace.d.ts +0 -12
  112. package/lib/types/client/panel/ModelPicker.d.ts +0 -11
  113. package/lib/types/client/panel/ProgressHomeView.d.ts +0 -5
  114. package/lib/types/client/panel/PropLibrary.d.ts +0 -8
  115. package/lib/types/client/panel/SceneLibrary.d.ts +0 -16
  116. package/lib/types/client/panel/StoryboardTab.d.ts +0 -19
  117. package/lib/types/client/panel/StyleCard.d.ts +0 -8
  118. package/lib/types/client/panel/StyleGallery.d.ts +0 -1
  119. package/lib/types/comic-presets.d.ts +0 -12
  120. package/lib/types/manga-genre-rules.d.ts +0 -22
  121. package/lib/types/prompt-utils.d.ts +0 -35
  122. package/lib/types/review-policy.d.ts +0 -97
  123. package/lib/types/shot-language.d.ts +0 -46
  124. package/lib/types/src/ai-scan.d.ts +0 -36
  125. package/lib/types/src/assets.d.ts +0 -37
  126. package/lib/types/src/assistant.d.ts +0 -45
  127. package/lib/types/src/author-assets.d.ts +0 -25
  128. package/lib/types/src/bookshelf.d.ts +0 -42
  129. package/lib/types/src/client/api.d.ts +0 -234
  130. package/lib/types/src/client/docx.d.ts +0 -15
  131. package/lib/types/src/client/index.d.ts +0 -14
  132. package/lib/types/src/client/locales.d.ts +0 -212
  133. package/lib/types/src/client/mount.d.ts +0 -9
  134. package/lib/types/src/client/panel/AdaptModeView.d.ts +0 -5
  135. package/lib/types/src/client/panel/AssetsTab.d.ts +0 -12
  136. package/lib/types/src/client/panel/AssistantTab.d.ts +0 -7
  137. package/lib/types/src/client/panel/AuthorAssetsView.d.ts +0 -4
  138. package/lib/types/src/client/panel/AuthorHome.d.ts +0 -32
  139. package/lib/types/src/client/panel/BookshelfBar.d.ts +0 -11
  140. package/lib/types/src/client/panel/CreateBookView.d.ts +0 -9
  141. package/lib/types/src/client/panel/FlowGuide.d.ts +0 -22
  142. package/lib/types/src/client/panel/GlobalAssetLibraryView.d.ts +0 -4
  143. package/lib/types/src/client/panel/ImportModal.d.ts +0 -7
  144. package/lib/types/src/client/panel/MangaRoleLibrary.d.ts +0 -20
  145. package/lib/types/src/client/panel/MangaWorkspace.d.ts +0 -12
  146. package/lib/types/src/client/panel/ModelManager.d.ts +0 -14
  147. package/lib/types/src/client/panel/NovelPanel.d.ts +0 -13
  148. package/lib/types/src/client/panel/ProgressConsole.d.ts +0 -17
  149. package/lib/types/src/client/panel/ProgressHomeView.d.ts +0 -5
  150. package/lib/types/src/client/panel/PropLibrary.d.ts +0 -8
  151. package/lib/types/src/client/panel/ReaderView.d.ts +0 -8
  152. package/lib/types/src/client/panel/ReasoningSection.d.ts +0 -10
  153. package/lib/types/src/client/panel/RunPanel.d.ts +0 -5
  154. package/lib/types/src/client/panel/SceneLibrary.d.ts +0 -16
  155. package/lib/types/src/client/panel/SettingsView.d.ts +0 -16
  156. package/lib/types/src/client/panel/ShelfView.d.ts +0 -15
  157. package/lib/types/src/client/panel/StoryboardTab.d.ts +0 -19
  158. package/lib/types/src/client/panel/StyleCard.d.ts +0 -8
  159. package/lib/types/src/client/panel/StyleGallery.d.ts +0 -1
  160. package/lib/types/src/client/panel/WorldTab.d.ts +0 -10
  161. package/lib/types/src/client/panel/controller.d.ts +0 -19
  162. package/lib/types/src/client/panel/helpers.d.ts +0 -18
  163. package/lib/types/src/client/panel/views.d.ts +0 -77
  164. package/lib/types/src/client/sidebar-entry.d.ts +0 -13
  165. package/lib/types/src/client/text.d.ts +0 -9
  166. package/lib/types/src/comic-presets.d.ts +0 -12
  167. package/lib/types/src/docx.d.ts +0 -19
  168. package/lib/types/src/engine.d.ts +0 -402
  169. package/lib/types/src/index.d.ts +0 -79
  170. package/lib/types/src/manga-genre-rules.d.ts +0 -22
  171. package/lib/types/src/novel-context.d.ts +0 -80
  172. package/lib/types/src/prompt-utils.d.ts +0 -35
  173. package/lib/types/src/protocol.d.ts +0 -2176
  174. package/lib/types/src/review-policy.d.ts +0 -97
  175. package/lib/types/src/routes.d.ts +0 -29
  176. package/lib/types/src/run.d.ts +0 -32
  177. package/lib/types/src/shot-language.d.ts +0 -46
  178. package/lib/types/src/story-beat-language.d.ts +0 -35
  179. package/lib/types/src/style-library.d.ts +0 -33
  180. package/lib/types/story-beat-language.d.ts +0 -35
  181. package/lib/types/style-library.d.ts +0 -33
  182. package/src/ai-scan.ts +0 -179
  183. package/src/assets.ts +0 -1774
  184. package/src/assistant.ts +0 -915
  185. package/src/author-assets.ts +0 -147
  186. package/src/bookshelf.ts +0 -167
  187. package/src/client/api.ts +0 -716
  188. package/src/client/css-modules.d.ts +0 -8
  189. package/src/client/docx.ts +0 -69
  190. package/src/client/index.ts +0 -34
  191. package/src/client/llmLive.ts +0 -101
  192. package/src/client/locales.ts +0 -418
  193. package/src/client/mount.tsx +0 -97
  194. package/src/client/mount.tsx._new +0 -97
  195. package/src/client/mount.tsx._nf +0 -97
  196. package/src/client/mount.tsx._tmp +0 -97
  197. package/src/client/panel/AdaptModeView.tsx +0 -535
  198. package/src/client/panel/AssetsTab.tsx +0 -458
  199. package/src/client/panel/AssistantTab.tsx +0 -339
  200. package/src/client/panel/AuthorAssetsView.tsx +0 -208
  201. package/src/client/panel/AuthorHome.tsx +0 -234
  202. package/src/client/panel/BookAnalysisView.tsx +0 -60
  203. package/src/client/panel/BookshelfBar.tsx +0 -170
  204. package/src/client/panel/CreateBookView.tsx +0 -371
  205. package/src/client/panel/DirectorView.tsx +0 -200
  206. package/src/client/panel/FlowGuide.tsx +0 -84
  207. package/src/client/panel/GlobalAssetLibraryView.tsx +0 -172
  208. package/src/client/panel/IdeaInspirationView.tsx +0 -71
  209. package/src/client/panel/ImportModal.tsx +0 -303
  210. package/src/client/panel/KnowledgeBaseView.tsx +0 -73
  211. package/src/client/panel/LiveFeedLog.tsx +0 -76
  212. package/src/client/panel/MangaRoleLibrary.tsx +0 -1002
  213. package/src/client/panel/MangaWorkspace.tsx +0 -715
  214. package/src/client/panel/MarketRadarView.tsx +0 -374
  215. package/src/client/panel/ModelManager.tsx +0 -205
  216. package/src/client/panel/NovelPanel.tsx +0 -4721
  217. package/src/client/panel/ProgressConsole.tsx +0 -63
  218. package/src/client/panel/ProgressHomeView.tsx +0 -87
  219. package/src/client/panel/PropLibrary.tsx +0 -175
  220. package/src/client/panel/ReaderView.tsx +0 -306
  221. package/src/client/panel/ReasoningSection.tsx +0 -31
  222. package/src/client/panel/RunPanel.tsx +0 -204
  223. package/src/client/panel/SceneLibrary.tsx +0 -453
  224. package/src/client/panel/SettingsView.tsx +0 -289
  225. package/src/client/panel/ShelfView.tsx +0 -242
  226. package/src/client/panel/StoryboardTab.tsx +0 -472
  227. package/src/client/panel/StyleCard.tsx +0 -90
  228. package/src/client/panel/StyleGallery.tsx +0 -58
  229. package/src/client/panel/WorldTab.tsx +0 -202
  230. package/src/client/panel/controller.ts +0 -45
  231. package/src/client/panel/helpers.ts +0 -67
  232. package/src/client/panel/panel.module.css +0 -4359
  233. package/src/client/panel/views.tsx +0 -314
  234. package/src/client/sidebar-entry.ts +0 -122
  235. package/src/client/text.ts +0 -28
  236. package/src/comic-presets.ts +0 -67
  237. package/src/docx.ts +0 -83
  238. package/src/engine.ts +0 -5636
  239. package/src/global-assets.ts +0 -59
  240. package/src/index.ts +0 -346
  241. package/src/llm-live.ts +0 -68
  242. package/src/manga-genre-rules.ts +0 -87
  243. package/src/market-radar-scan.ts +0 -41
  244. package/src/market-radar-sources.ts +0 -173
  245. package/src/novel-context.ts +0 -287
  246. package/src/prompt-utils.ts +0 -73
  247. package/src/prompting.ts +0 -159
  248. package/src/protocol.ts +0 -2565
  249. package/src/review-policy.ts +0 -161
  250. package/src/routes.ts +0 -3939
  251. package/src/run.ts +0 -338
  252. package/src/shot-language.ts +0 -181
  253. package/src/story-beat-language.ts +0 -130
  254. package/src/style-library.ts +0 -84
@@ -1,97 +0,0 @@
1
- /**
2
- * 审稿规则注册表
3
- *
4
- * 生成用 compact 模式(核心规则),审稿用 full 模式(全部规则),
5
- * 消除 reviewSystemPrompt 内嵌规则与 renderAllAssets() 两套打架的问题。
6
- */
7
- /** 通用写作资产规则(兼容 ProjectAssets 中的各类规则) */
8
- export interface WritingRule {
9
- name: string;
10
- description: string;
11
- type?: string;
12
- enabled?: boolean;
13
- }
14
- export interface ReviewRule {
15
- id: string;
16
- /** 规则维度 */
17
- dimension: 'character' | 'setting' | 'redline' | 'writing' | 'pacing' | 'logic' | 'anti-ai' | 'presentation' | 'compliance';
18
- /** 严重度 */
19
- severity: 'high' | 'medium' | 'low';
20
- /** 规则类型:forbidden=禁止类(命中即问题),encourage=鼓励类(不命中不算错) */
21
- type: 'forbidden' | 'encourage';
22
- /** 规则描述 */
23
- description: string;
24
- /** 是否启用 */
25
- enabled: boolean;
26
- /** 作用域 */
27
- scope: Array<'writing' | 'review' | 'polish' | 'all'>;
28
- }
29
- /** 内置审稿维度(结构化评分用) */
30
- export declare const REVIEW_DIMENSIONS: readonly [{
31
- readonly id: "character";
32
- readonly name: "人设一致性";
33
- readonly weight: 0.2;
34
- }, {
35
- readonly id: "setting";
36
- readonly name: "设定一致性";
37
- readonly weight: 0.15;
38
- }, {
39
- readonly id: "redline";
40
- readonly name: "红线检查";
41
- readonly weight: 0.15;
42
- }, {
43
- readonly id: "writing";
44
- readonly name: "文笔质量";
45
- readonly weight: 0.15;
46
- }, {
47
- readonly id: "pacing";
48
- readonly name: "节奏与爽点";
49
- readonly weight: 0.1;
50
- }, {
51
- readonly id: "logic";
52
- readonly name: "逻辑漏洞";
53
- readonly weight: 0.1;
54
- }, {
55
- readonly id: "anti-ai";
56
- readonly name: "反 AI 规则";
57
- readonly weight: 0.05;
58
- }, {
59
- readonly id: "presentation";
60
- readonly name: "呈现方式";
61
- readonly weight: 0.05;
62
- }, {
63
- readonly id: "compliance";
64
- readonly name: "内容合规";
65
- readonly weight: 0.05;
66
- }];
67
- export type ReviewDimensionId = typeof REVIEW_DIMENSIONS[number]['id'];
68
- /** 维度结构化评分 */
69
- export interface DimensionScore {
70
- dimension: ReviewDimensionId;
71
- score: number;
72
- note: string;
73
- }
74
- /**
75
- * 渲染审稿规则(compact 或 full 模式)
76
- *
77
- * compact: 只渲染禁止类 + high 严重度(用于生成时的约束)
78
- * full: 渲染全部启用规则(用于审稿时的检查清单)
79
- */
80
- export declare function renderReviewRules(assets: WritingRule[] | undefined, mode?: 'compact' | 'full'): string;
81
- /**
82
- * 从审稿 issues 中按维度统计
83
- * 用于结构化评分和 UI 展示。
84
- */
85
- export declare function groupIssuesByDimension(issues: Array<{
86
- severity: string;
87
- item: string;
88
- dimension?: string;
89
- }>): Record<string, Array<{
90
- severity: string;
91
- item: string;
92
- }>>;
93
- /**
94
- * 计算维度加权总分
95
- * 用于审稿报告的结构化评分。
96
- */
97
- export declare function calculateWeightedScore(dimensions: DimensionScore[]): number;
@@ -1,29 +0,0 @@
1
- /**
2
- * The /api/dsh-novel-forge route family: status, docx outline loading, LLM
3
- * story-bible extraction, volume planning, chapter planning, streaming
4
- * generation / rewrite / polish (NDJSON frames), review, summaries,
5
- * foreshadows, export, chapter reading, config patching, and opening the
6
- * output folder. Every route carries the same loopback-only trust fence as
7
- * the family plugins — these endpoints invoke the LLM and write files on the
8
- * host machine.
9
- */
10
- import type { WebRoute } from '@deepseek-ai/dsh-host-webserver';
11
- import type { Context } from '@deepseek-ai/cordis';
12
- import { type BibleResponse, type ConfigPatch, type ExportResponse, type LoadOutlineResponse, type NovelConfig, type PlanResponse, type StatusResponse, type VolumesResponse } from './protocol.ts';
13
- import { chapterFileName } from './engine.ts';
14
- /** Route deps. */
15
- export interface NovelRoutesDeps {
16
- ctx: Context;
17
- /** Resolve the live plugin config (settings-aware). */
18
- getConfig: () => NovelConfig;
19
- /** Persist a config patch through the settings seam. */
20
- patchConfig: (patch: ConfigPatch) => Promise<NovelConfig>;
21
- }
22
- /**
23
- * Build every /api/dsh-novel-forge route.
24
- * @param deps - context, config resolver, config patcher.
25
- * @returns the route list.
26
- */
27
- export declare function makeRoutes(deps: NovelRoutesDeps): WebRoute[];
28
- export type { ConfigPatch, NovelConfig, StatusResponse, PlanResponse, LoadOutlineResponse, BibleResponse, VolumesResponse, ExportResponse, };
29
- export { chapterFileName };
@@ -1,32 +0,0 @@
1
- import type { Context } from '@deepseek-ai/cordis';
2
- import type { NovelConfig, RunState } from './protocol.ts';
3
- export declare class ProductionRunner {
4
- private deps;
5
- private state;
6
- private working;
7
- private pauseRequested;
8
- private stopRequested;
9
- /** 生产单绑定目录(start 时快照;所有读写固定用它,防止运行中切书导致写错目录)。 */
10
- private bookDir;
11
- constructor(deps: {
12
- ctx: Context;
13
- getConfig: () => NovelConfig;
14
- });
15
- /** 当前生产单状态(内存优先;web 重启后从磁盘恢复)。 */
16
- status(): RunState | null;
17
- private persist;
18
- private log;
19
- /** 启动/续跑生产单:startNo..endNo 区间,endNo 超出计划时先自动补计划。 */
20
- start(startNo: number, endNo: number): Promise<RunState>;
21
- pause(): void;
22
- resume(): void;
23
- stop(): void;
24
- /** 主循环:从 currentNo 扫描到 endNo,逐章处理;支持暂停/停止。 */
25
- private loop;
26
- private processChapter;
27
- /** 完整质量门:生成 → 摘要+事实 → 伏笔标记 → 审稿 → 作者复盘。 */
28
- private produce;
29
- /** 被拒分级处理:无 high 豁免;有 high 按意见修订(最多 2 轮)+ 验证模式;仍不过 → 待人工。 */
30
- private handleRejected;
31
- private applyDraft;
32
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * 镜头语言词库(分镜规范化基准)。
3
- * 分镜表的 shot/camera/composition/light 字段统一从这里取值(英文 id),
4
- * 生成提示词时用 zh 中文词块;适配英文平台时用 en。
5
- * 目的:让"景别/运镜/构图/光效"有标准词表,避免 LLM 自由发挥导致漂移。
6
- */
7
- /** 景别。 */
8
- export type ShotSizeId = 'extreme_wide' | 'wide' | 'full' | 'medium' | 'medium_close' | 'close' | 'extreme_close' | 'big_extreme_close';
9
- /** 运镜/机位。 */
10
- export type CameraMoveId = 'static' | 'dolly_in' | 'dolly_out' | 'pan_left' | 'pan_right' | 'track_left' | 'track_right' | 'follow' | 'pedestal_up' | 'pedestal_down' | 'orbit' | 'handheld' | 'low_angle' | 'high_angle' | 'over_shoulder';
11
- /** 构图。 */
12
- export type CompositionId = 'rule_of_thirds' | 'center' | 'leading_line' | 'foreground' | 'low' | 'overhead' | 'symmetry';
13
- /** 光效。 */
14
- export type LightingId = 'front' | 'side' | 'back' | 'top' | 'rembrandt' | 'neon' | 'hard' | 'soft' | 'mood' | 'contrast';
15
- export interface ShotLangEntry<T extends string> {
16
- id: T;
17
- /** 中文(提示词/展示用)。 */
18
- zh: string;
19
- /** 英文(英文平台适配用)。 */
20
- en: string;
21
- /** 一句话说明(下拉/卡片)。 */
22
- hint: string;
23
- }
24
- export declare const SHOT_SIZES: readonly ShotLangEntry<ShotSizeId>[];
25
- export declare const CAMERA_MOVES: readonly ShotLangEntry<CameraMoveId>[];
26
- export declare const COMPOSITIONS: readonly ShotLangEntry<CompositionId>[];
27
- export declare const LIGHTINGS: readonly ShotLangEntry<LightingId>[];
28
- export interface ShotLanguage {
29
- shot?: ShotSizeId;
30
- camera: CameraMoveId[];
31
- composition?: CompositionId;
32
- light: LightingId[];
33
- }
34
- /** 从中文文本归一化到景别(处理旧数据/LLM 口语)。未知回退 medium。 */
35
- export declare function normalizeShotSize(text: string | undefined): ShotSizeId;
36
- /** 从中文文本归一化到运镜列表。 */
37
- export declare function normalizeCameras(text: string | undefined): CameraMoveId[];
38
- /** 从中文文本归一化到构图(可选)。 */
39
- export declare function normalizeComposition(text: string | undefined): CompositionId | undefined;
40
- /** 从中文文本归一化到光效列表。 */
41
- export declare function normalizeLightings(text: string | undefined): LightingId[];
42
- /** 取词条中文(ZHs 合并句子)。 */
43
- export declare function sizeZh(id: ShotSizeId | undefined): string;
44
- export declare function cameraZh(ids: CameraMoveId[] | undefined): string;
45
- export declare function compoZh(id: CompositionId | undefined): string;
46
- export declare function lightZh(ids: LightingId[] | undefined): string;
@@ -1,35 +0,0 @@
1
- /**
2
- * 编剧词库(剧情骨架规范化基准)。
3
- * 骨架的 function(叙事功能)与 emotion(情绪走向)统一从这里取值(英文 id),
4
- * 生成提示词/展示时用 zh 中文。
5
- * 目的:让"叙事功能/情绪"有标准词表,避免 LLM 自由发挥导致情绪链漂移。
6
- */
7
- /** 叙事功能(对应节拍在剧情中的作用)。 */
8
- export type StoryFunctionId = 'exposition' | 'conflict' | 'turn' | 'climax' | 'resolve' | 'foreshadow' | 'character';
9
- /** 情绪词(低→高能量的情绪阶,角色在节拍中的主要情绪点)。 */
10
- export type EmotionId = 'calm' | 'indifferent' | 'expectant' | 'curious' | 'alert' | 'suppressed' | 'enduring' | 'worried' | 'irritable' | 'uneasy' | 'terrified' | 'angry' | 'collapsing' | 'resolute' | 'grieved' | 'relieved' | 'bittersweet' | 'triumphant' | 'reborn' | 'numb';
11
- export interface BeatLangEntry<T extends string> {
12
- id: T;
13
- /** 中文(展示用)。 */
14
- zh: string;
15
- /** 英文(英文平台适配用)。 */
16
- en: string;
17
- /** 一句话说明。 */
18
- hint: string;
19
- }
20
- /** 叙事功能词表。 */
21
- export declare const STORY_FUNCTIONS: readonly BeatLangEntry<StoryFunctionId>[];
22
- /** 情绪词表(按能量/阶段排序)。 */
23
- export declare const EMOTIONS: readonly BeatLangEntry<EmotionId>[];
24
- export interface StoryBeatLanguage {
25
- function: StoryFunctionId;
26
- emotion: EmotionId[];
27
- }
28
- /** 从中文归一化叙事功能(未知回退 exposition)。 */
29
- export declare function normalizeStoryFunction(text: string | undefined): StoryFunctionId;
30
- /** 从中文文本归一化情绪词列表(可含→箭头链)。 */
31
- export declare function normalizeEmotions(text: string | undefined): EmotionId[];
32
- /** 叙事功能中文。 */
33
- export declare function functionZh(id: StoryFunctionId | undefined): string;
34
- /** 情绪中文(箭头连接)。 */
35
- export declare function emotionZh(ids: EmotionId[] | undefined): string;
@@ -1,33 +0,0 @@
1
- /**
2
- * 风格库(内置模板):漫剧方案的视觉基底 + 可叠加滤镜。
3
- * 关键词针对即梦 Seedream 优化:画风定义 + 质感描述 + 光影色彩 + 即梦质量词(8K/五官清晰/真实材质)。
4
- */
5
- export type StyleCategory = '3d' | 'game' | '2d' | 'craft' | 'film';
6
- export interface ArtStyle {
7
- id: string;
8
- /** 风格名(用户可见)。 */
9
- name: string;
10
- category: StyleCategory;
11
- /** 特点一句话(卡片展示)。 */
12
- traits: string;
13
- /** 风格关键词/前缀(生成角色图/视频提示词时套用)。 */
14
- keywords: string;
15
- /** 是否可作为滤镜叠加在基底风格之上(影视实验类;缺省 false)。 */
16
- stackable?: boolean;
17
- /** 默认推荐排序权重(0-1,推荐池排序参考)。 */
18
- weight?: number;
19
- }
20
- export declare const STYLE_CATEGORIES: ReadonlyArray<{
21
- id: StyleCategory;
22
- label: string;
23
- icon: string;
24
- desc: string;
25
- }>;
26
- /** 内置风格模板(基底 21 个 + 滤镜 3 个)。 */
27
- export declare const STYLE_LIBRARY: ArtStyle[];
28
- /** 按分类取风格。 */
29
- export declare function stylesByCategory(category: StyleCategory): ArtStyle[];
30
- /** 取单个风格(未找到返回 undefined)。 */
31
- export declare function findStyle(id: string): ArtStyle | undefined;
32
- /** 按基底 + 滤镜拼接风格关键词(角色图/分镜/视频提示词共用;缺省回退 3D 动漫)。 */
33
- export declare function styleKeywords(styleId?: string, filterId?: string): string;
@@ -1,35 +0,0 @@
1
- /**
2
- * 编剧词库(剧情骨架规范化基准)。
3
- * 骨架的 function(叙事功能)与 emotion(情绪走向)统一从这里取值(英文 id),
4
- * 生成提示词/展示时用 zh 中文。
5
- * 目的:让"叙事功能/情绪"有标准词表,避免 LLM 自由发挥导致情绪链漂移。
6
- */
7
- /** 叙事功能(对应节拍在剧情中的作用)。 */
8
- export type StoryFunctionId = 'exposition' | 'conflict' | 'turn' | 'climax' | 'resolve' | 'foreshadow' | 'character';
9
- /** 情绪词(低→高能量的情绪阶,角色在节拍中的主要情绪点)。 */
10
- export type EmotionId = 'calm' | 'indifferent' | 'expectant' | 'curious' | 'alert' | 'suppressed' | 'enduring' | 'worried' | 'irritable' | 'uneasy' | 'terrified' | 'angry' | 'collapsing' | 'resolute' | 'grieved' | 'relieved' | 'bittersweet' | 'triumphant' | 'reborn' | 'numb';
11
- export interface BeatLangEntry<T extends string> {
12
- id: T;
13
- /** 中文(展示用)。 */
14
- zh: string;
15
- /** 英文(英文平台适配用)。 */
16
- en: string;
17
- /** 一句话说明。 */
18
- hint: string;
19
- }
20
- /** 叙事功能词表。 */
21
- export declare const STORY_FUNCTIONS: readonly BeatLangEntry<StoryFunctionId>[];
22
- /** 情绪词表(按能量/阶段排序)。 */
23
- export declare const EMOTIONS: readonly BeatLangEntry<EmotionId>[];
24
- export interface StoryBeatLanguage {
25
- function: StoryFunctionId;
26
- emotion: EmotionId[];
27
- }
28
- /** 从中文归一化叙事功能(未知回退 exposition)。 */
29
- export declare function normalizeStoryFunction(text: string | undefined): StoryFunctionId;
30
- /** 从中文文本归一化情绪词列表(可含→箭头链)。 */
31
- export declare function normalizeEmotions(text: string | undefined): EmotionId[];
32
- /** 叙事功能中文。 */
33
- export declare function functionZh(id: StoryFunctionId | undefined): string;
34
- /** 情绪中文(箭头连接)。 */
35
- export declare function emotionZh(ids: EmotionId[] | undefined): string;
@@ -1,33 +0,0 @@
1
- /**
2
- * 风格库(内置模板):漫剧方案的视觉基底 + 可叠加滤镜。
3
- * 关键词针对即梦 Seedream 优化:画风定义 + 质感描述 + 光影色彩 + 即梦质量词(8K/五官清晰/真实材质)。
4
- */
5
- export type StyleCategory = '3d' | 'game' | '2d' | 'craft' | 'film';
6
- export interface ArtStyle {
7
- id: string;
8
- /** 风格名(用户可见)。 */
9
- name: string;
10
- category: StyleCategory;
11
- /** 特点一句话(卡片展示)。 */
12
- traits: string;
13
- /** 风格关键词/前缀(生成角色图/视频提示词时套用)。 */
14
- keywords: string;
15
- /** 是否可作为滤镜叠加在基底风格之上(影视实验类;缺省 false)。 */
16
- stackable?: boolean;
17
- /** 默认推荐排序权重(0-1,推荐池排序参考)。 */
18
- weight?: number;
19
- }
20
- export declare const STYLE_CATEGORIES: ReadonlyArray<{
21
- id: StyleCategory;
22
- label: string;
23
- icon: string;
24
- desc: string;
25
- }>;
26
- /** 内置风格模板(基底 21 个 + 滤镜 3 个)。 */
27
- export declare const STYLE_LIBRARY: ArtStyle[];
28
- /** 按分类取风格。 */
29
- export declare function stylesByCategory(category: StyleCategory): ArtStyle[];
30
- /** 取单个风格(未找到返回 undefined)。 */
31
- export declare function findStyle(id: string): ArtStyle | undefined;
32
- /** 按基底 + 滤镜拼接风格关键词(角色图/分镜/视频提示词共用;缺省回退 3D 动漫)。 */
33
- export declare function styleKeywords(styleId?: string, filterId?: string): string;
package/src/ai-scan.ts DELETED
@@ -1,179 +0,0 @@
1
- /**
2
- * 本地 AI 味扫描器(不调 LLM,确定性检测)
3
- *
4
- * 用途:生成/润色后自动扫描,结果作为「事实锚点」注入审稿提示词,
5
- * 让 LLM 做判断而非机械统计。也可用于 UI 展示 AI 味指标。
6
- */
7
-
8
- export interface AiScanResult {
9
- /** 总评分 0-100,越高越像 AI 写的 */
10
- aiScore: number
11
- /** 命中的套话及次数 */
12
- clicheHits: Array<{ word: string; count: number }>
13
- /** 段落长度方差(过高=段落过于整齐) */
14
- paragraphLengthVariance: number
15
- /** 连续解释性叙事段数(≥3 视为问题) */
16
- consecutiveExpositoryParagraphs: number
17
- /** 句式重复率(相同开头句式占比) */
18
- sentenceRepetitionRate: number
19
- /** 过长段落数(>300字) */
20
- longParagraphCount: number
21
- /** 过短段落数(<20字) */
22
- shortParagraphCount: number
23
- /** 对话占比(0-1) */
24
- dialogueRatio: number
25
- /** 问题摘要,可直接注入审稿提示词 */
26
- summary: string
27
- }
28
-
29
- /** 重灾区套话(高频出现即问题) */
30
- const HEAVY_CLICHES = [
31
- '不禁', '仿佛', '一时间', '不由得', '顿时', '然而',
32
- '缓缓', '轻轻', '微微', '默默', '似乎', '终于',
33
- '显然', '其实', '无法形容', '难以言喻', '不由自主',
34
- ]
35
-
36
- /** 轻微套话(偶尔出现可接受,高频才问题) */
37
- const LIGHT_CLICHES = [
38
- '心中', '脑海', '眼神', '嘴角', '眉头', '身影',
39
- '气息', '光芒', '力量', '感觉', '知道', '明白',
40
- ]
41
-
42
- /** 解释性叙事开头模式 */
43
- const EXPOSITORY_STARTS = [
44
- '原来', '因为', '由于', '所以', '因此', '于是',
45
- '这就是', '也就是说', '换句话说', '事实上', '实际上',
46
- ]
47
-
48
- export function scanAiFlavor(text: string): AiScanResult {
49
- const paragraphs = text.split(/\n{2,}/).map(p => p.trim()).filter(p => p.length > 0)
50
- const totalChars = text.length
51
-
52
- // 1. 套话统计
53
- const clicheHits: Array<{ word: string; count: number }> = []
54
- let clicheTotal = 0
55
- for (const word of [...HEAVY_CLICHES, ...LIGHT_CLICHES]) {
56
- const count = countOccurrences(text, word)
57
- if (count > 0) {
58
- clicheHits.push({ word, count })
59
- clicheTotal += count
60
- }
61
- }
62
- clicheHits.sort((a, b) => b.count - a.count)
63
-
64
- // 2. 段落长度方差
65
- const paraLengths = paragraphs.map(p => p.length)
66
- const avgLen = paraLengths.length > 0 ? paraLengths.reduce((a, b) => a + b, 0) / paraLengths.length : 0
67
- const variance = paraLengths.length > 0
68
- ? paraLengths.reduce((sum, len) => sum + Math.pow(len - avgLen, 2), 0) / paraLengths.length
69
- : 0
70
-
71
- // 3. 连续解释性叙事
72
- let maxConsecutive = 0
73
- let currentConsecutive = 0
74
- for (const p of paragraphs) {
75
- const isExpository = EXPOSITORY_STARTS.some(s => p.startsWith(s)) ||
76
- (p.length > 150 && !p.includes('"') && !p.includes('「') && !p.includes('『'))
77
- if (isExpository) {
78
- currentConsecutive++
79
- maxConsecutive = Math.max(maxConsecutive, currentConsecutive)
80
- } else {
81
- currentConsecutive = 0
82
- }
83
- }
84
-
85
- // 4. 句式重复率(相同句首词)
86
- const sentences = text.split(/[。!?!?]/).map(s => s.trim()).filter(s => s.length > 0)
87
- const starterCounts = new Map<string, number>()
88
- for (const s of sentences) {
89
- const starter = s.slice(0, 2)
90
- starterCounts.set(starter, (starterCounts.get(starter) ?? 0) + 1)
91
- }
92
- const repeatedStarters = Array.from(starterCounts.values()).filter(c => c >= 3).reduce((a, b) => a + b, 0)
93
- const sentenceRepetitionRate = sentences.length > 0 ? repeatedStarters / sentences.length : 0
94
-
95
- // 5. 段落长度分布
96
- const longParagraphCount = paraLengths.filter(l => l > 300).length
97
- const shortParagraphCount = paraLengths.filter(l => l < 20).length
98
-
99
- // 6. 对话占比
100
- const dialogueChars = (text.match(/["「『][^"」』]*["」』]/g) ?? []).join('').length
101
- const dialogueRatio = totalChars > 0 ? dialogueChars / totalChars : 0
102
-
103
- // 7. 综合 AI 味评分(0-100,越高越像 AI)
104
- let aiScore = 0
105
- // 套话密度(每千字套话数)
106
- const clicheDensity = totalChars > 0 ? (clicheTotal / totalChars) * 1000 : 0
107
- aiScore += Math.min(40, clicheDensity * 8)
108
- // 段落过于整齐(方差小=AI特征)
109
- if (variance < 2000 && paraLengths.length >= 5) aiScore += 15
110
- // 连续解释性叙事
111
- aiScore += Math.min(20, maxConsecutive * 5)
112
- // 句式重复
113
- aiScore += Math.min(15, sentenceRepetitionRate * 30)
114
- // 对话过少
115
- if (dialogueRatio < 0.05 && totalChars > 1000) aiScore += 10
116
- aiScore = Math.min(100, Math.round(aiScore))
117
-
118
- // 8. 问题摘要
119
- const issues: string[] = []
120
- if (clicheDensity > 3) {
121
- const topCliches = clicheHits.slice(0, 5).map(h => `${h.word}×${h.count}`).join('、')
122
- issues.push(`套话密度偏高(每千字 ${clicheDensity.toFixed(1)} 次):${topCliches}`)
123
- }
124
- if (maxConsecutive >= 3) issues.push(`连续 ${maxConsecutive} 段解释性叙事,缺少对话/动作`)
125
- if (sentenceRepetitionRate > 0.15) issues.push(`句式重复率 ${(sentenceRepetitionRate * 100).toFixed(0)}%,开头句式单一`)
126
- if (longParagraphCount > 3) issues.push(`${longParagraphCount} 段超过 300 字,段落过长`)
127
- if (dialogueRatio < 0.05 && totalChars > 1000) issues.push('对话占比过低,整章偏叙述')
128
-
129
- const summary = issues.length > 0
130
- ? `本地 AI 味扫描(AI 味指数 ${aiScore}/100):\n` + issues.map(i => `- ${i}`).join('\n')
131
- : `本地 AI 味扫描(AI 味指数 ${aiScore}/100):未发现明显问题。`
132
-
133
- return {
134
- aiScore,
135
- clicheHits,
136
- paragraphLengthVariance: Math.round(variance),
137
- consecutiveExpositoryParagraphs: maxConsecutive,
138
- sentenceRepetitionRate: Math.round(sentenceRepetitionRate * 100) / 100,
139
- longParagraphCount,
140
- shortParagraphCount,
141
- dialogueRatio: Math.round(dialogueRatio * 100) / 100,
142
- summary,
143
- }
144
- }
145
-
146
- function countOccurrences(text: string, word: string): number {
147
- if (word.length === 0) return 0
148
- let count = 0
149
- let idx = text.indexOf(word)
150
- while (idx !== -1) {
151
- count++
152
- idx = text.indexOf(word, idx + word.length)
153
- }
154
- return count
155
- }
156
-
157
- /** 扫描前后对比(润色时用) */
158
- export function compareAiScan(before: AiScanResult, after: AiScanResult): {
159
- improved: boolean
160
- deltaScore: number
161
- details: string[]
162
- } {
163
- const deltaScore = before.aiScore - after.aiScore
164
- const details: string[] = []
165
- if (deltaScore > 0) details.push(`AI 味指数下降 ${deltaScore} 分(${before.aiScore} → ${after.aiScore})`)
166
- else if (deltaScore < 0) details.push(`AI 味指数上升 ${-deltaScore} 分(${before.aiScore} → ${after.aiScore}),需检查`)
167
- else details.push(`AI 味指数持平(${before.aiScore})`)
168
-
169
- const beforeCliches = before.clicheHits.reduce((a, b) => a + b.count, 0)
170
- const afterCliches = after.clicheHits.reduce((a, b) => a + b.count, 0)
171
- if (afterCliches < beforeCliches) details.push(`套话减少 ${beforeCliches - afterCliches} 处`)
172
- else if (afterCliches > beforeCliches) details.push(`套话增加 ${afterCliches - beforeCliches} 处`)
173
-
174
- return {
175
- improved: deltaScore > 0,
176
- deltaScore,
177
- details,
178
- }
179
- }