cortico-world-imggen 0.3.4 → 0.4.2

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 CHANGED
@@ -8,6 +8,32 @@
8
8
  > 思路移植自 [dsh-image-studio](https://github.com/aa1355721445-lgtm/dsh-image-studio)(本地参考库 + 关键词 + 发图策略),
9
9
  > 但按 Cortico 的 World 契约重写:没有 DSH 的宿主 API,所以调度、发图、管理页面都是自己实现的。
10
10
 
11
+ ## 0.4.1 更新
12
+
13
+ - **后端档案(profiles)**:把「后端 + 接口 + 模型 + key」存成一组,切换时整组生效。
14
+ `imggen_comfy` 新增 `profiles` / `useProfile` / `saveProfile`;工作室页面状态栏多了「档案」下拉。
15
+ 云端和本地各自的接口、模型、工作流不再互相污染。
16
+ - **key 跟着档案走**:档案的 key 存在 `imggen-secret.json` 的 `profiles` 里,不进配置文件(避免配置文件被贴进群里带走 key)。
17
+ 优先级:档案 key > 配置里手填 > secret 全局 key > .env 变量。
18
+ - **网络错误说人话**:以前只有 `fetch failed`,现在会写明 ENOTFOUND(DNS)/ ECONNRESET(连接被重置)/ UND_ERR_CONNECT_TIMEOUT(超时)/ 证书问题等底层原因。
19
+ - 存档案不再自动激活(连续保存多个档案不会把当前档案顶掉)。
20
+
21
+ ## 0.4.0 更新
22
+
23
+ - **双后端**:云端接口 / 本机 ComfyUI(8188)。工作室页面顶部一键切换,桌宠也能用 `imggen_comfy set backend=local|cloud` 自己切。
24
+ - **人物 LoRA + 工作流自由搭配**:模板里没有角色节点时自动注入;同一个画风/姿势工作流可以配任意角色 LoRA。
25
+ - **工作流模板下拉**:扫 `H:/AI/ComfyUI/workflows/*.json`,工作室页面和设置页都能选;配套 `导出API模板.cmd` 一键把 ComfyUI 界面工作流转成 API 模板。
26
+ - **后台出图**:本地出图先把工具交回去,画完推一条内部事件给 Coo(它会自己知道画好了),不卡对话。
27
+ - **本地纯提示词模式**(默认开):走本地时 prompt 原样提交,不套中文分节、不用参考图;桌宠自己写完整英文 tag。
28
+ - **卡住自动重提**:显存抖动卡在 Model Initializing 时自动中断重跑。
29
+ - **上下文瘦身**:ENV_PROMPT 从 2836 字符压到 1720(-39%),工具参数说明同步收紧。
30
+ - 修:本地模式下不再要求 API Key;`imggen_comfy` 支持按文件名切换工作流。
31
+
32
+ ## 工具一览(0.4.0)
33
+
34
+ `imggen_draw` / `imggen_send` / `imggen_list` / `imggen_library` / `imggen_jobs` / `imggen_comfy`
35
+
36
+
11
37
  ## 它做了什么
12
38
 
13
39
  - **四个工具**
@@ -221,6 +247,11 @@ ONEBOT_TOKEN=<协议端 token> IMGGEN_KEY=<key> IMGGEN_REFS="D:\a.png;D:\b.png"
221
247
 
222
248
  ## 更新日志
223
249
 
250
+ ### 0.3.5
251
+
252
+ - 工作室尺寸按钮标出**价格倍率**(相对 1024×1024):火山这类接口按输出 token 计费,token ≈ 像素数 ÷ 256,所以倍率就等于相对价格。实测 1024² = 4,096 tok、2560×1440 = 14,400 tok(3.5×)。
253
+ - 尺寸预设新增「小横屏 1280×720」(0.88×,比方图还便宜)。
254
+
224
255
  ### 0.3.4
225
256
 
226
257
  - 工作室生成页体验:
package/describe.json CHANGED
@@ -2,81 +2,81 @@
2
2
  "tools": [
3
3
  {
4
4
  "name": "imggen_draw",
5
- "description": "画一张图存到本地并直接发到 QQ。prompt 只写画面本身,神态/动作/镜头/光线用下面的关键词,别在 prompt 里重复。人物/服饰/场景/道具都填参考库里的名字;to 抄 QQ 消息 meta 里的 conv。回执有路径、尺寸、关键词、参考图和发送结果,「生成失败」开头不算成功;一张几十秒,等回执。",
5
+ "description": "画一张图,存本地并发 QQ。prompt 只写画面;神态/动作/镜头/光线用关键词;人物/服饰/场景/道具填库里的名字。to 抄消息 meta 里的 conv。回执含路径、尺寸和发送结果;「生成失败」不算成功。本地约 30 秒~2 分钟。",
6
6
  "parameters": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
9
9
  "properties": {
10
10
  "prompt": {
11
11
  "type": "string",
12
- "description": "画面:谁在做什么、在哪、什么风格。一到三句。"
12
+ "description": "画面本身:谁在做啥、在哪、什么风格。一到两句;本地写英文 tag"
13
13
  },
14
14
  "characters": {
15
15
  "type": "array",
16
16
  "items": {
17
17
  "type": "string"
18
18
  },
19
- "description": "出镜人物(库里的名字,可多个),保证长相一致。"
19
+ "description": "人物名(库里的)"
20
20
  },
21
21
  "outfits": {
22
22
  "type": "array",
23
23
  "items": {
24
24
  "type": "string"
25
25
  },
26
- "description": "服饰(库里的名字),不填自动搭配。"
26
+ "description": "服饰名,不填自动配"
27
27
  },
28
28
  "scene": {
29
29
  "type": "string",
30
- "description": "场景(库里的名字)。"
30
+ "description": "场景名"
31
31
  },
32
32
  "props": {
33
33
  "type": "array",
34
34
  "items": {
35
35
  "type": "string"
36
36
  },
37
- "description": "道具(库里的名字)。"
37
+ "description": "道具名"
38
38
  },
39
39
  "situation": {
40
40
  "type": "string",
41
- "description": "情境(词表里的名字)。"
41
+ "description": "情境关键词(定整体场合)"
42
42
  },
43
43
  "expression": {
44
44
  "type": "string",
45
- "description": "神态(词表里的名字)。"
45
+ "description": "神态关键词"
46
46
  },
47
47
  "pose": {
48
48
  "type": "string",
49
- "description": "动作(词表里的名字)。"
49
+ "description": "动作关键词"
50
50
  },
51
51
  "shot": {
52
52
  "type": "string",
53
- "description": "镜头(词表里的名字)。"
53
+ "description": "镜头关键词"
54
54
  },
55
55
  "light": {
56
56
  "type": "string",
57
- "description": "光线(词表里的名字),不填用情境默认。"
57
+ "description": "光线,不填用情境默认"
58
58
  },
59
59
  "size": {
60
60
  "type": "string",
61
- "description": "覆盖默认尺寸,如 1024x1024。"
61
+ "description": "尺寸,如 1024x1024"
62
62
  },
63
63
  "count": {
64
64
  "type": "integer",
65
65
  "minimum": 1,
66
66
  "maximum": 4,
67
- "description": "张数,默认 1;多张更慢更贵。"
67
+ "description": "张数,默认 1"
68
68
  },
69
69
  "to": {
70
70
  "type": "string",
71
- "description": "group:<群号> 或 private:<QQ号>;不填用默认目标。"
71
+ "description": "group:<群号> / private:<QQ号>"
72
72
  },
73
73
  "caption": {
74
74
  "type": "string",
75
- "description": "跟图一起发的一句话。"
75
+ "description": "跟图一起说的话"
76
76
  },
77
77
  "send": {
78
78
  "type": "boolean",
79
- "description": "false = 只生成不发。"
79
+ "description": "false = 只存不发"
80
80
  }
81
81
  },
82
82
  "required": [
@@ -91,24 +91,70 @@
91
91
  "en": "Draws an image using the reference library, saves it and sends it to QQ."
92
92
  }
93
93
  },
94
+ {
95
+ "name": "imggen_redraw",
96
+ "description": "以图改图:拿一张已有的图当底图,按 prompt 重绘。file 填 imggen_list 的文件名或绝对路径,不填用最新一张。denoise 越小越贴近原图(0.3 只是微调细节,0.7 改动很大),默认 0.55。底图的构图和人物位置会保留,只有画面内容按 prompt 变。只有本地 ComfyUI 支持,云端会拒绝。",
97
+ "parameters": {
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "properties": {
101
+ "file": {
102
+ "type": "string",
103
+ "description": "底图文件名或绝对路径;不填=最新一张"
104
+ },
105
+ "prompt": {
106
+ "type": "string",
107
+ "description": "改完要变成什么样,写英文 tag 更稳"
108
+ },
109
+ "denoise": {
110
+ "type": "number",
111
+ "minimum": 0.1,
112
+ "maximum": 0.95,
113
+ "description": "重绘幅度,默认 0.55"
114
+ },
115
+ "to": {
116
+ "type": "string",
117
+ "description": "group:<群号> / private:<QQ号>"
118
+ },
119
+ "caption": {
120
+ "type": "string",
121
+ "description": "跟图一起说的话"
122
+ },
123
+ "send": {
124
+ "type": "boolean",
125
+ "description": "false = 只存不发"
126
+ }
127
+ },
128
+ "required": [
129
+ "prompt"
130
+ ]
131
+ },
132
+ "tags": [
133
+ "act"
134
+ ],
135
+ "summary": {
136
+ "zh": "拿一张已有的图当底图改图(图生图)。",
137
+ "en": "Redraws an existing image with a prompt (img2img)."
138
+ }
139
+ },
94
140
  {
95
141
  "name": "imggen_send",
96
- "description": "把之前生成过的一张图再发一次(不重新生成,不花钱)。file 填 imggen_list 给出的文件名,不填就发最新的一张。对方说「再发一次」「发刚才那张」时用它,不要重新 imggen_draw。",
142
+ "description": "把生成过的图再发一次(不重新生成、不花钱)。file 填 imggen_list 给的文件名,不填发最新一张。对方说「再发一次」时用它,别重新画。",
97
143
  "parameters": {
98
144
  "type": "object",
99
145
  "additionalProperties": false,
100
146
  "properties": {
101
147
  "file": {
102
148
  "type": "string",
103
- "description": "文件名或完整路径(必须在本扩展的图片目录内)。不填 = 最新一张。"
149
+ "description": "文件名;不填=最新一张"
104
150
  },
105
151
  "to": {
106
152
  "type": "string",
107
- "description": "发送目标:group:<群号> 或 private:<QQ号>。不填用默认目标。"
153
+ "description": "group:<群号> / private:<QQ号>"
108
154
  },
109
155
  "caption": {
110
156
  "type": "string",
111
- "description": "可选,跟图一起发出的一句话。"
157
+ "description": "跟图一起说的话"
112
158
  }
113
159
  },
114
160
  "required": []
@@ -123,7 +169,7 @@
123
169
  },
124
170
  {
125
171
  "name": "imggen_list",
126
- "description": "列出本地已生成的图片(文件名、大小、时间)和保存目录。想知道有哪些图、或要给 imggen_send 挑文件名时用。",
172
+ "description": "列出已生成的图(文件名/大小/时间)和保存目录。给 imggen_send 挑文件名时用。",
127
173
  "parameters": {
128
174
  "type": "object",
129
175
  "additionalProperties": false,
@@ -132,7 +178,7 @@
132
178
  "type": "integer",
133
179
  "minimum": 1,
134
180
  "maximum": 50,
135
- "description": "最多列几张,默认 10。"
181
+ "description": "最多几张,默认 10"
136
182
  }
137
183
  },
138
184
  "required": []
@@ -147,7 +193,7 @@
147
193
  },
148
194
  {
149
195
  "name": "imggen_library",
150
- "description": "本地参考库(人物/服饰/场景/道具)。list 看清单,get 看某条设定与参考图,add 存新条目(file 填图片路径或 http 地址),update 改字段,remove 挪进回收站。出图前不确定名字就 list,别猜;对方说「记住这个角色」先拿图片路径再 add。",
196
+ "description": "本地参考库(人物/服饰/场景/道具):list 看清单,get 看某条设定与参考图,add 存新条目(file 填路径或 http 地址),update 改字段,remove 挪回收站。出图前不确定名字就 list,别猜。",
151
197
  "parameters": {
152
198
  "type": "object",
153
199
  "additionalProperties": false,
@@ -175,48 +221,48 @@
175
221
  },
176
222
  "name": {
177
223
  "type": "string",
178
- "description": "条目名(get/update/remove 用;add 时是新条目名)。"
224
+ "description": "条目名"
179
225
  },
180
226
  "description": {
181
227
  "type": "string",
182
- "description": "add/update:外观描述,只写长相或设计,会进提示词。"
228
+ "description": "外观,只写长相/设计"
183
229
  },
184
230
  "aliases": {
185
231
  "type": "array",
186
232
  "items": {
187
233
  "type": "string"
188
234
  },
189
- "description": "add/update:别名。"
235
+ "description": "别名"
190
236
  },
191
237
  "tags": {
192
238
  "type": "array",
193
239
  "items": {
194
240
  "type": "string"
195
241
  },
196
- "description": "add/update:标签。"
242
+ "description": "标签"
197
243
  },
198
244
  "persona": {
199
245
  "type": "string",
200
- "description": "add/update:人设,只给自己看,不外发。"
246
+ "description": "人设,不外发"
201
247
  },
202
248
  "expressions": {
203
249
  "type": "string",
204
- "description": "add/update:神态特点,会进提示词。"
250
+ "description": "神态特点"
205
251
  },
206
252
  "defaultOutfit": {
207
253
  "type": "string",
208
- "description": "add/update:默认服饰(服饰条目名)。"
254
+ "description": "默认服饰名"
209
255
  },
210
256
  "outfitByContext": {
211
257
  "type": "object",
212
258
  "additionalProperties": {
213
259
  "type": "string"
214
260
  },
215
- "description": "add/update:情境→服饰名,如 {\"睡前\":\"睡衣\"};也收 \"睡前=睡衣, 刚睡醒=睡衣\"。只对人物有用。"
261
+ "description": "情境→服饰,如 {\"睡前\":\"睡衣\"}"
216
262
  },
217
263
  "file": {
218
264
  "type": "string",
219
- "description": "add:参考图,本地路径或 http(s) 地址。"
265
+ "description": "参考图路径或 URL"
220
266
  }
221
267
  },
222
268
  "required": [
@@ -231,6 +277,100 @@
231
277
  "zh": "查本地参考库(人物/服饰/场景/道具),也能把图存成新条目。",
232
278
  "en": "Queries or edits the local reference library."
233
279
  }
280
+ },
281
+ {
282
+ "name": "imggen_jobs",
283
+ "description": "查后台出图任务(本地出图很慢时 imggen_draw 会先回任务号,画好自动发)。想知道「画好了没」才查,正常闲聊不用。",
284
+ "parameters": {
285
+ "type": "object",
286
+ "additionalProperties": false,
287
+ "properties": {
288
+ "limit": {
289
+ "type": "integer",
290
+ "minimum": 1,
291
+ "maximum": 20,
292
+ "description": "最多几条,默认 5"
293
+ }
294
+ },
295
+ "required": []
296
+ },
297
+ "tags": [
298
+ "read"
299
+ ],
300
+ "summary": {
301
+ "zh": "查后台出图任务的进度(本地出图时用)。",
302
+ "en": "Checks background drawing jobs."
303
+ }
304
+ },
305
+ {
306
+ "name": "imggen_comfy",
307
+ "description": "本地设置:status 看状态,list 列可用 LoRA / 工作流(按架构分组),set 改(backend=local|cloud;model=本地模型架构名;lora=文件名,空串不挂;workflow=路径或文件名,空串用内置)。profiles / useProfile / saveProfile 管后端档案。换画风、换 LoRA、快速试几张用它。",
308
+ "parameters": {
309
+ "type": "object",
310
+ "additionalProperties": false,
311
+ "properties": {
312
+ "q": {
313
+ "type": "string",
314
+ "description": "list 时按关键词过滤 LoRA / 工作流名"
315
+ },
316
+ "action": {
317
+ "type": "string",
318
+ "enum": [
319
+ "status",
320
+ "list",
321
+ "set",
322
+ "profiles",
323
+ "useProfile",
324
+ "saveProfile",
325
+ "restart"
326
+ ],
327
+ "description": "status 看状态;list 列 LoRA/工作流;set 改后端/模型/LoRA/工作流;profiles 列档案;useProfile 切档案;saveProfile 存档案"
328
+ },
329
+ "backend": {
330
+ "type": "string",
331
+ "enum": [
332
+ "local",
333
+ "cloud"
334
+ ],
335
+ "description": "set:local/cloud"
336
+ },
337
+ "model": {
338
+ "type": "string",
339
+ "enum": [
340
+ "krea2",
341
+ "anima"
342
+ ],
343
+ "description": "set:本地模型架构(本机装的那几个;不确定先 status)"
344
+ },
345
+ "lora": {
346
+ "type": "string",
347
+ "description": "set:角色 LoRA 文件名,空=不挂"
348
+ },
349
+ "workflow": {
350
+ "type": "string",
351
+ "description": "set:工作流文件名,空=内置"
352
+ },
353
+ "profile": {
354
+ "type": "string",
355
+ "description": "useProfile/saveProfile:档案名"
356
+ },
357
+ "apiKey": {
358
+ "type": "string",
359
+ "description": "saveProfile:顺手把这个档案的 key 存下来(可选)"
360
+ }
361
+ },
362
+ "required": [
363
+ "action"
364
+ ]
365
+ },
366
+ "tags": [
367
+ "read",
368
+ "act"
369
+ ],
370
+ "summary": {
371
+ "zh": "看/改本地 ComfyUI 的设置(用哪个 LoRA、哪个工作流)。",
372
+ "en": "Views or changes local ComfyUI options (LoRA, workflow)."
373
+ }
234
374
  }
235
375
  ],
236
376
  "events": []
package/icon.png ADDED
Binary file
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "cortico-world-imggen",
3
- "version": "0.3.4",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
- "description": "Coopanion World:本地参考库 + 关键词的生图工作室,桌宠自己画图并把图直接发到 QQ。",
5
+ "description": "生图工具包:给桌宠画她现在的样子(做饭、出门买菜、按描述换造型),支持云端口与本机 ComfyUI,可与其他插件联动。",
6
6
  "license": "MIT",
7
7
  "main": "./src/definition.ts",
8
8
  "exports": {
@@ -12,8 +12,13 @@
12
12
  "files": [
13
13
  "src",
14
14
  "scripts",
15
+ "icon.png",
15
16
  "describe.json",
16
- "README.md"
17
+ "README.md",
18
+ "发布说明-0.4.0.md",
19
+ "发布说明-0.4.1.md",
20
+ "发布说明-0.4.2.md",
21
+ "更新公告-0.4.2.md"
17
22
  ],
18
23
  "engines": {
19
24
  "node": ">=22"
@@ -33,7 +38,7 @@
33
38
  "cortico": {
34
39
  "kind": "world",
35
40
  "api": 6,
36
- "displayName": "生图工作室",
41
+ "displayName": "鱼的生图包",
37
42
  "describe": "describe.json",
38
43
  "tags": [
39
44
  "im",
@@ -47,16 +52,22 @@
47
52
  ],
48
53
  "locales": {
49
54
  "zh": {
50
- "displayName": "生图工作室",
51
- "description": "带本地参考库(人物/服饰/场景/道具)和关键词(情境/神态/动作/镜头/光线)的生图能力:Coo 按画面描述自动挑参考图、拼提示词,出图后直接发到 QQ。接口地址、模型名、Key 都在设置页填,换服务商不用改代码;还有一个本机的素材库页面可以拖图管理。"
55
+ "displayName": "鱼的生图包",
56
+ "description": "给你的大肥鱼加上生图工具包,随时随地展示她现在的样子,例如正在做饭,或者依你描述造型,出门买菜,可与其他插件联动。支持本地参考库(人物/服饰/场景/道具)与关键词词表,云端接口与本机 ComfyUI 双后端,人物 LoRA 与画风/姿势工作流自由搭配,出图直接发到 QQ,后台出图不卡对话。"
52
57
  },
53
58
  "en": {
54
- "displayName": "Image studio",
55
- "description": "Image generation with a local reference library (characters, outfits, scenes, props) and keyword presets (situation, expression, pose, shot, light). Coo picks reference images, builds the prompt, draws, and sends the picture straight to QQ. Endpoint, model and key live in the settings page; a local studio page handles the library."
59
+ "displayName": "Fish's Image Pack",
60
+ "description": "Image generation with a local reference library and keyword presets, sending results straight to QQ. Dual backend (cloud API or local ComfyUI) with backend profiles: backend + endpoint + model + key switch as one group. Character LoRA pairs with any style/pose workflow; background drawing keeps chat responsive."
56
61
  }
57
- }
62
+ },
63
+ "icon": "icon.png"
58
64
  },
59
65
  "dependencies": {},
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "https://github.com/cormini/cortico-world-imggen.git"
69
+ },
70
+ "homepage": "https://github.com/cormini/cortico-world-imggen#readme",
60
71
  "scripts": {
61
72
  "describe": "node --experimental-transform-types --no-warnings scripts/gen-describe.mjs",
62
73
  "test": "node --experimental-transform-types --no-warnings scripts/test-providers.mjs",
package/scripts/smoke.mjs CHANGED
@@ -48,7 +48,7 @@ const tools = world.tools();
48
48
  const names = tools.map((t) => t.name).sort().join(',');
49
49
  const declared = def.describe.tools.map((t) => t.name).sort().join(',');
50
50
  check(names === declared, 'tools() 与 describe.tools 不一致:' + names + ' vs ' + declared);
51
- check(tools.length === 4, '应该有 4 个工具,实际 ' + tools.length);
51
+ check(tools.length === 6, '应该有 6 个工具,实际 ' + tools.length);
52
52
 
53
53
  // ── 提示词变量 ──
54
54
  const vars = world.envPromptVars();
@@ -66,7 +66,7 @@ for (const k of ['endpoint', 'model', 'refMode', 'maxRefs', 'libraryRoot', 'stud
66
66
  }
67
67
  const styleProp = ui.config?.[0]?.schema?.properties?.['worlds.imggen.requestStyle'];
68
68
  check(Array.isArray(styleProp?.enum) && styleProp.enum.includes('task65535'), 'requestStyle 应带 enum 且含 task65535');
69
- check(ui.promptDocs?.[0]?.vars?.length === 7, '提示词变量应声明 7 个,实际 ' + ui.promptDocs?.[0]?.vars?.length);
69
+ check(ui.promptDocs?.[0]?.vars?.length === 8, '提示词变量应声明 8 个,实际 ' + ui.promptDocs?.[0]?.vars?.length);
70
70
  check((ui.lamps ?? []).length >= 2, '应至少有两个状态灯');
71
71
 
72
72
  // ── 列表工具 ──
@@ -141,4 +141,4 @@ if (problems.length) {
141
141
  for (const p of problems) console.log(' - ' + p);
142
142
  process.exit(1);
143
143
  }
144
- console.log('\n装配冒烟:全部通过(4 个工具 / 7 个提示词变量 / 库增删改查 / 工作室页面)');
144
+ console.log('\n装配冒烟:全部通过(6 个工具 / 8 个提示词变量 / 库增删改查 / 工作室页面)');
@@ -0,0 +1,57 @@
1
+ // Anima base v1.0 vs turbo v1.1 对比 + 高清模板验证
2
+ import { writeFileSync } from 'node:fs';
3
+ import { DEFAULTS, normalizeConfig } from '../src/config.ts';
4
+ import { generateImages } from '../src/providers.ts';
5
+
6
+ const WF = 'H:/AI/ComfyUI/workflows';
7
+ const PROMPT = [
8
+ 'masterpiece, best quality, 1girl, solo, deep blue gradient long hair, whale fin ears, white lace maid headdress,',
9
+ 'navy maid dress with white whale apron, white thighhighs, barefoot, sitting on a navy whale cushion,',
10
+ 'hugging knees, night study room, wooden desk, pink white mechanical keyboard, black monitor,',
11
+ 'rainy window with city lights, warm desk lamp, detailed background, anime style',
12
+ ].join(' ');
13
+
14
+ const NEG = 'lowres, worst quality, bad anatomy, extra legs, bad hands, missing fingers, watermark, text';
15
+
16
+ const base = {
17
+ ...DEFAULTS,
18
+ requestStyle: 'comfyui',
19
+ comfyUrl: 'http://127.0.0.1:8188',
20
+ comfyWorkflowDir: WF,
21
+ comfyNegative: NEG,
22
+ comfyLora: '',
23
+ };
24
+
25
+ const cases = [
26
+ { tag: 'turbo-12步', wf: WF + '/Anima-快速试构图-API.json', w: 1280, h: 720, steps: 12, cfg: 1, sampler: 'euler', sched: 'simple' },
27
+ { tag: 'base-30步', wf: WF + '/Anima-底图正式版-API.json', w: 1280, h: 720, steps: 30, cfg: 5.5, sampler: 'euler_ancestral', sched: 'simple' },
28
+ { tag: 'base高清-放大2x', wf: WF + '/Anima-高清放大-API.json', w: 1280, h: 720, steps: 30, cfg: 5.5, sampler: 'euler_ancestral', sched: 'simple' },
29
+ ];
30
+
31
+ for (const c of cases) {
32
+ const cfg = normalizeConfig({
33
+ ...base,
34
+ comfyArch: 'anima',
35
+ comfyWorkflow: c.wf,
36
+ comfySteps: c.steps,
37
+ comfyCfg: c.cfg,
38
+ comfySampler: c.sampler,
39
+ comfyScheduler: c.sched,
40
+ });
41
+ const t0 = Date.now();
42
+ try {
43
+ const imgs = await generateImages({
44
+ cfg,
45
+ key: '',
46
+ prompt: PROMPT,
47
+ size: `${c.w} x ${c.h}`.replace(/\s/g, ''),
48
+ count: 1,
49
+ refs: [],
50
+ });
51
+ const out = `H:\\deepseek工作区\\.tmp\\ab-${c.tag}.png`;
52
+ writeFileSync(out, imgs[0].bytes);
53
+ console.log(`✅ ${c.tag} ${((Date.now() - t0) / 1000).toFixed(1)}s ${(imgs[0].bytes.length / 1024).toFixed(0)}KB → ${out}`);
54
+ } catch (e) {
55
+ console.log(`❌ ${c.tag} ${String(e.message).slice(0, 200)}`);
56
+ }
57
+ }
@@ -0,0 +1,54 @@
1
+ // A) S1 光效 LoRA 三个强度 B) AddMicroDetails 作为默认画质 LoRA 的三个强度 + 无 LoRA 基线
2
+ import { writeFileSync, mkdirSync } from 'node:fs';
3
+ import { DEFAULTS, normalizeConfig } from '../src/config.ts';
4
+ import { generateImages } from '../src/providers.ts';
5
+
6
+ const OUT = 'H:\\大肥鱼桌宠\\生图文件\\Anima-LoRA测试-第二轮';
7
+ mkdirSync(OUT, { recursive: true });
8
+
9
+ const BASE = 'masterpiece, best quality, 1girl, solo, silver hair, blue eyes, white dress, sitting by the window, rainy night city lights, detailed background, anime style';
10
+ const NEG = 'lowres, worst quality, bad anatomy, bad hands, extra fingers, watermark, text';
11
+ const SEED = 20261117;
12
+
13
+ const CASES = [
14
+ { tag: '00-无LoRA基线', lora: '', strength: 0, prompt: BASE },
15
+ { tag: '01-细节045', lora: 'AddMicroDetails_Anima_v2.safetensors', strength: 0.45, prompt: 'addmicrodetails, ' + BASE },
16
+ { tag: '02-细节055', lora: 'AddMicroDetails_Anima_v2.safetensors', strength: 0.55, prompt: 'addmicrodetails, ' + BASE },
17
+ { tag: '03-细节070', lora: 'AddMicroDetails_Anima_v2.safetensors', strength: 0.7, prompt: 'addmicrodetails, ' + BASE },
18
+ { tag: '04-S1光效040', lora: 'S1_Dramatic Lighting Anima_V2.safetensors', strength: 0.4, prompt: BASE },
19
+ { tag: '05-S1光效055', lora: 'S1_Dramatic Lighting Anima_V2.safetensors', strength: 0.55, prompt: BASE },
20
+ { tag: '06-S1光效070', lora: 'S1_Dramatic Lighting Anima_V2.safetensors', strength: 0.7, prompt: BASE },
21
+ ];
22
+
23
+ for (const c of CASES) {
24
+ const cfg = normalizeConfig({
25
+ ...DEFAULTS,
26
+ requestStyle: 'comfyui',
27
+ comfyUrl: 'http://127.0.0.1:8188',
28
+ comfyArch: 'anima',
29
+ comfyWorkflow: 'H:/AI/ComfyUI/workflows/Anima-底图正式版-API.json',
30
+ comfyLora: c.lora,
31
+ comfyLoraStrength: c.strength || 0.9,
32
+ comfyNegative: NEG,
33
+ comfySteps: 30,
34
+ comfyCfg: 5.5,
35
+ comfySampler: 'euler_ancestral',
36
+ comfyScheduler: 'simple',
37
+ });
38
+ const t0 = Date.now();
39
+ try {
40
+ const imgs = await generateImages({
41
+ cfg,
42
+ key: '',
43
+ prompt: c.prompt,
44
+ size: '1024x576',
45
+ count: 1,
46
+ refs: [],
47
+ // 固定种子以便对比
48
+ });
49
+ writeFileSync(`${OUT}\\${c.tag}.png`, imgs[0].bytes);
50
+ console.log(`✅ ${c.tag} ${((Date.now() - t0) / 1000).toFixed(1)}s`);
51
+ } catch (e) {
52
+ console.log(`❌ ${c.tag} ${String(e.message).slice(0, 160)}`);
53
+ }
54
+ }