dsh-novel-image 0.0.0 → 0.4.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.
package/docs/DETAIL.md ADDED
@@ -0,0 +1,113 @@
1
+ # dsh-novel-image 详情
2
+
3
+ ## 定位
4
+
5
+ DSH 小说插件系列的“视觉设定”层。它不训练模型,也不自动出图;它做三件事:
6
+
7
+ 1. 从正文抽取**有原文依据**的视觉锚点;
8
+ 2. 把锚点编译成**不同生图工具能直接吃**的提示词包;
9
+ 3. 把外部首稿**导回来读图对照**,生成修改提示词。
10
+
11
+ ## 0.1 工作流
12
+
13
+ ### 1. 导入正文
14
+
15
+ - 工具:`image_import_text`
16
+ - 参数:`dir`(工作区)、`title`、`text`、`maxChapterIndex`(剧透边界)、`characterNames`(建议显式给)。
17
+ - 结果:作品 + 初版视觉设定;每条锚点带章节号与原文引文。
18
+
19
+ ### 2. 审阅视觉设定
20
+
21
+ - 工具:`image_get_canon`
22
+ - 每条锚点有 `status`:`draft / confirmed / locked / rejected`。
23
+ - 用 `image_update_anchor` 做决定;锁定后重新抽取不会覆盖。
24
+ - 章节备注:`fromChapter` / `toChapter`;完整角色变体见 0.2 的 `variants[]`。
25
+
26
+ ### 3. 编译提示词包
27
+
28
+ - 工具:`image_compile_prompt`
29
+ - `task`:`cover / portrait / scene / sheet`
30
+ - `profileId`:`natural-zh / natural-en / sd-tags / midjourney / comfyui / generic`
31
+ - `platformId`:封面平台预设(`qidian / fanqie / jinjiang / weread / douban / kdp / apple-books`)
32
+ - 结果:`positive / negative / parameters / referencePlan / workflowBindings`,以及 `warnings`。
33
+ - 0.1 只输出提示词,不发网络请求、不调用生图 API。
34
+
35
+ ### 4. 一键带走
36
+
37
+ - 工具:`image_export_prompt`
38
+ - `format=text`:可直接粘贴的完整包(比例 + 提示词 + 负面 + 参考图说明 + 注意)。
39
+ - `format=markdown`:给人看。
40
+ - `format=json`:存档/程序用。
41
+
42
+ ### 5. 导入首稿并读图回改
43
+
44
+ - `image_import_draft`:给 `path` 或 `dataBase64`,可关联 `packId`。
45
+ - `image_critique_draft`:当前模型必须支持图片输入;输出:
46
+ - `anchorChecks[]`:每条锁定/确认锚点的 `matched / partial / missing / wrong / unclear`;
47
+ - `compositionChecks[]`:标题安全区、文字乱码、缩略图、多人、正脸、姿态;
48
+ - `styleChecks[]`:媒介、配色、光影、AI 感;
49
+ - `keep / fix / add / unclear`。
50
+ - `image_revise_draft`:输出两版修改提示词:
51
+ - `editPrompt`:保留构图,改局部(适合封面/图生图/局部重绘);
52
+ - `regeneratePrompt`:改完整提示词重抽(适合立绘换姿态/表情)。
53
+ - 模型不支持看图:返回 `vision-model-required`,不会编造审稿结论。
54
+
55
+ ## 0.2 新增
56
+
57
+ - **显示名**:侧栏显示名“视觉设定”,Tab“设定”;内部 `canon` 领域名不变。
58
+ - **资产库**:`image_import_asset` / `image_list_assets` / `image_set_asset_reference`;可绑定角色、用途(face/full-body/outfit/style/scene/other)、许可/备注。
59
+ - **参考图计划**:`image_compile_prompt` 自动读取已设参考图,按 profile 上限生成 `referencePlan.slots`;超限丢弃并在 `warnings` 说明。粘贴块/Markdown 会列出参考图。
60
+ - **回改历史**:`image_list_critiques`;`image_compare_critiques` 按锚点分类 `resolved / persisting / introduced / unchanged`。
61
+ - **风格学习**:`image_analyze_style` 让视觉模型分析一张封面/人物设计图,存成风格档案(媒介/配色/构图/标题区/排版/光影/正负向前缀);`image_compile_prompt` 接 `styleId` 套用。**推理时提取,不训练模型。**
62
+ - **三种导入入口**:选文件、选文件夹(最多 20 张)、联网搜索(`image_search_references`,只返回链接,不自动下载)。
63
+ - **侧栏底色**:20 种底色,localStorage 记忆。
64
+ - 右栏新增「资产」Tab;回改 Tab 增加“对比上一版”。
65
+
66
+ ## 0.3 / 0.4 任务与连接器
67
+
68
+ - **Provider**:`image_list_providers` / `image_save_provider` / `image_test_provider`;mock、ComfyUI、OpenAI 兼容、manual;只存端点/模型/workflow/credentialRef,不存明文 Key。
69
+ - **任务**:`image_submit_job` / `image_job_status` / `image_list_jobs` / `image_cancel_job` / `image_retry_job`;状态机 `queued → submitting → running → succeeded/failed/cancelled`;失败可重试为新 job。
70
+ - **ComfyUI**:workflow 模板(`image_save_workflow` / `image_list_workflows`)、`/prompt`、`/history`、`/view`、`/upload/image` 参考图、`{{positive}}/{{negative}}/{{width}}/{{height}}/{{seed}}/{{ref_image}}` 绑定。
71
+ - **OpenAI 兼容**:`/v1/images/generations` 与 `/v1/images/edits`(单参考图);`credentialRef=env:NAME`;429 自动重试(只 429)。
72
+ - **增量**:`image_incremental_plan` / `image_apply_incremental`;重抽保留 locked/confirmed 锚点与变体。
73
+ - 真实网络实测后置;0.4 的自动重试只覆盖 429,5xx/超时不自动重试。
74
+
75
+ ## 数据目录
76
+
77
+ ```
78
+ .dsh-novel-image/
79
+ works/<workId>/
80
+ work.json # 作品 + 章节索引
81
+ source/<chapterId>.txt # 本次导入的章节文本(私有副本)
82
+ canon.json # 视觉设定(revision)
83
+ packs/<packId>.json # 提示词包
84
+ drafts/<draftId>.json # 首稿元数据 + 图片
85
+ critiques/<id>.json # 读图审稿报告
86
+ revisions/<id>.json # 修改提示词
87
+ assets/index.json # 资产索引(0.2)
88
+ assets/<assetId>/... # 参考图/约稿图(0.2)
89
+ styles/<styleId>.json # 参考图学习出的风格档案(0.2)
90
+ jobs/<jobId>.json # 生图任务(0.3)
91
+ workflows/<id>.json # ComfyUI 模板(0.3)
92
+ profiles/providers/<id>.json # 生图 provider(0.3)
93
+ ```
94
+
95
+ `profiles/providers/<providerId>.json` 存 provider profile;旧版本为 0.3a 占位,现含能力/重试/限速字段。
96
+
97
+ ## 边界
98
+
99
+ - 只写 `.dsh-novel-image/`。
100
+ - 不读其他 `.dsh-novel-*` 目录;正文/角色卡需要显式导入。
101
+ - 不回写正文、角色卡、读者档案。
102
+ - 图片只存本地 + DSH attachment store;调用视觉模型前会提示图片会发给当前模型。
103
+ - 不内置越狱/绕过上游安全策略的话术。
104
+
105
+ ## 已知限制
106
+
107
+ - 确定性抽取只认“句子里出现角色名”的外貌句;代词/跨句描写会漏。
108
+ - LLM 补充抽取只读前 6 章,避免一次烧太多 token;更多章节需分批。
109
+ - 标签方言是小词表翻译 + 原始中文兜底,不保证 SD 模型一定吃;复杂意象用自然语言包。
110
+ - 0.1 的“章节备注”不是完整变体系统;完整 overlay 在 0.2。
111
+ - 首稿回改只做单张,不做 v1/v2 对比链(0.2)。
112
+ - 平台封面规格会变;预设带 `status/lastVerified`,发布前复核。
113
+
package/icon.svg ADDED
@@ -0,0 +1,8 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" role="img" aria-label="Novel visual canon">
2
+ <rect width="64" height="64" rx="14" fill="#2f4a3f"/>
3
+ <path d="M16 16h15c3 0 5 2 5 5v27c-2-2-4-3-7-3H16z" fill="#f4f1e8" opacity=".95"/>
4
+ <path d="M48 16H33c-3 0-5 2-5 5v27c2-2 4-3 7-3h13z" fill="#dbe6dd" opacity=".95"/>
5
+ <circle cx="24" cy="24" r="3.2" fill="#c58a3d"/>
6
+ <path d="M18 38l6-8 5 6 4-4 6 8H18z" fill="#4f7a62"/>
7
+ <path d="M39 21l5 3-5 3z" fill="#2f4a3f" opacity=".55"/>
8
+ </svg>