dsh-mo-image 1.0.2 → 1.0.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # 更新日志
2
2
 
3
+ ## v1.0.4
4
+
5
+ - **加强设置、更新和图片预览的访问保护。** 这些功能现在会先验证 DSH 登录状态。登录后,旧聊天里的预览图片仍可打开。
6
+
7
+ ## v1.0.3
8
+
9
+ - **更新优化:** 设置页中的自动更新按钮UI优化,自动更新时默认使用国内源。
10
+ - **ComfyUI工作流适配优化:**系统将自动识别提示词、尺寸、质量、参考图这类参数。
11
+
3
12
  ## v1.0.2
4
13
 
5
14
  - **删除提供商需要二次确认:** 设置页里点行右侧的「删除」不再立刻生效:弹出与「设置 → 对话模型」同源的确认弹窗。
package/LICENSE CHANGED
@@ -19,3 +19,37 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
+
23
+ Third-party notices
24
+ -------------------
25
+
26
+ dsh-codex-model-effort-selector
27
+
28
+ The Codex-skin geometry (272×104 popover, 30px knob, rail padding), the
29
+ per-level colour ramps (light/dark), the deterministic sparkle/bloom
30
+ distribution, the ⚡ Fast toggle/`fast-mode` class contract, the peak
31
+ gradient/sparkle treatment and several interaction details in `lib/client.js`
32
+ are adapted from dsh-codex-model-effort-selector
33
+ (https://github.com/ABING1111/dsh-codex-model-effort-selector).
34
+
35
+ MIT License
36
+
37
+ Copyright (c) 2026 dsh-codex-model-effort-selector contributors
38
+
39
+ Permission is hereby granted, free of charge, to any person obtaining a copy
40
+ of this software and associated documentation files (the "Software"), to deal
41
+ in the Software without restriction, including without limitation the rights
42
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43
+ copies of the Software, and to permit persons to whom the Software is
44
+ furnished to do so, subject to the following conditions:
45
+
46
+ The above copyright notice and this permission notice shall be included in all
47
+ copies or substantial portions of the Software.
48
+
49
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55
+ SOFTWARE.
package/README.md CHANGED
@@ -50,16 +50,16 @@ dsh plugin --profile desktop add github:CM-Silence/dsh-mo-image
50
50
 
51
51
  ## 更新
52
52
 
53
- DSH 每次启动会查一次 npm 上的最新版本(`registry.npmjs.org`,不通时退 `registry.npmmirror.com`)。有新版时,设置 → 生图模型 页顶部会出现「有可用更新」:点开能看到版本号和这次改了什么,点「更新」后插件在后台换成新版本,重启 DSH 后生效。
53
+ 插件启动后会从 `registry.npmmirror.com` 检查最新版本。有新版时,设置页的「生图模型」标题旁会显示「有可用更新」。点开可以查看版本号和更新说明,确认后交给 DSH 安装。镜像同步到新版本后才会显示更新提示。
54
54
 
55
55
  更新说明来自包里的 `CHANGELOG.md`(按版本从 jsDelivr / unpkg / npmmirror 读取);那个版本没写说明时,对话框显示「暂无更新说明」。
56
56
 
57
57
  - 用 `link:` 方式安装的开发环境不会自动改文件,点更新只会提示你自己 `git pull`。
58
- - 检测和安装都走 npm:点更新时按 `dsh-mo-image@x.y.z` 的版本规格安装,不依赖 GitHub。从 npm 安装的走 DSH 原生的 `updateBundle`(先卸旧版再装新版,装失败会自动装回旧版);早期用 `github:` 装的会被换成 npm 版——这条「先卸载再装」的路径没有 DSH 的自动回滚,所以 npm 安装失败时会按原来的规格装回去,并明确提示「更新安装失败,已装回原来的版本」;万一连装回也失败,会提示你去插件管理里重装,不会静默失败。
59
- - 没有桌面版的插件管理器时,手动更新:
58
+ - 安装时会把 `registry.npmmirror.com` 作为首选源传给 DSH,并按 `dsh-mo-image@x.y.z` 安装。DSH 仍会按宿主配置处理备用源和回滚。从 npm 安装的插件由 DSH 原生更新。早期从 `github:` 安装的插件会迁移到 npm 版,迁移失败时会尝试恢复原安装。
59
+ - 使用 `dsh web` 时也可以手动更新,把 `web` 换成实际使用的 profile。
60
60
 
61
61
  ~~~bash
62
- dsh plugin --profile desktop add dsh-mo-image
62
+ dsh plugin --profile web add dsh-mo-image --registry=https://registry.npmmirror.com
63
63
  ~~~
64
64
 
65
65
  维护者发版:
@@ -217,7 +217,7 @@ $DSH_HOME/mo-image/out/
217
217
 
218
218
  聊天里新生成的图片使用本地文件绝对路径,支持本地图片菜单的 DSH 客户端可以通过宿主读取原图、复制图片并在桌面文件夹中定位。找不到会话目录,或图片超过宿主的本地预览上限时,使用签名预览。
219
219
 
220
- 旧聊天中的 `/api/mo-image/preview/<basename>` 和签名预览链接继续可用。HMAC 签名 key 保存在 `$DSH_HOME/mo-image/preview.key`,因此签名链接在宿主重启后仍然有效。
220
+ 登录 DSH 后,旧聊天中的 `/api/mo-image/preview/<basename>` 和签名预览链接都可用。HMAC 签名 key 保存在 `$DSH_HOME/mo-image/preview.key`,因此签名链接在宿主重启后仍然有效。
221
221
 
222
222
  建议把 `generated-images/` 加进项目的 `.gitignore`,避免把生成图误提交。
223
223
 
@@ -359,8 +359,10 @@ $DSH_HOME/.credentials.yaml
359
359
  **ComfyUI 工作流与参数表**
360
360
 
361
361
  - 工作流优先级:模型选项里的自定义工作流 > 内置模板(按模型自动选,见上)。自定义工作流支持 `{{prompt}}` / `{{negative_prompt}}` / `{{width}}` / `{{height}}` / `{{seed}}` / `{{model}}` / `{{image}}` 七个占位符,占位符之外的部分原样发送。
362
- - 不写占位符也能用:「解析工作流」会从图里找出采样器、正/负 `CLIPTextEncode`、尺寸、seed、模型、参考图的落点并自动填好映射;映射面板只把手动可能要改的**宽 / 高 / 参考图**列出来(提示词与负面词由工具参数直接写入,seed 与模型是参数表里的普通行)。
363
- - 「解析参数」把工作流里所有原始值输入(例如 `steps`、`cfg`、`sampler_name`、`denoise`)列成候选,勾中即写入「常规」参数表:默认值取当前值、类型按值推断、参数名只是给对话模型看的键。
362
+ - 「解析工作流」自动映射提示词、宽高、可识别的质量档位和唯一的参考图输入。尺寸和质量统一在模型选择器里调整,设为「自动」后可由对话模型选择。未指定时保留工作流已有的值。
363
+ - 多参考图工作流可把图像输入设为 `{{image_1}}`、`{{image_2}}` 等,从 1 连续编号,最多 16 张。把对应节点命名为「主体图」「风格图」等,插件会把用途交给对话模型,按编号顺序传图。同一编号可在多个节点复用,`{{image}}` 仍代表第一张。未标记的图片保留原值。
364
+ - API 格式中接入输出链路的标准 `LoadImage` 可直接用于图生图。自定义节点的上传控件由「解析工作流」根据 ComfyUI 节点定义识别。没有可用参考图入口时,插件会在上传和提交前拒绝图生图。
365
+ - `steps`、`cfg`、`sampler_name`、`denoise`、种子等工作流参数保留在「常规」参数表里,默认沿用工作流原值。
364
366
  - 参数表才是运行时真正写工作流的东西:默认值非空的行随请求写入;清空默认值 = 不碰工作流里的原值;勾了「暴露」的行才出现在给对话模型的参数清单里。行级锁只挡一键配置,不挡手改。
365
367
  - 提示词与负面词不在参数表里;要手控落点就在工作流里写 `{{prompt}}` / `{{negative_prompt}}` 占位符。
366
368
 
@@ -539,7 +541,7 @@ $DSH_HOME/.credentials.yaml
539
541
 
540
542
  每个模型行末尾的折叠箭头打开该模型的选项。**预设来源的提供商箭头照旧在,只是禁用**(云端预设,以及走 OpenAI 兼容字段的本地预设 sd-server / localai / openai-gateway):预设定死了输入与返回,箭头禁用表示「这里本来有东西,只是这份配置不由你改」——删掉它反而会让列表里有的行有箭头、有的没有,看着像漏渲染。剩下两类才真能展开:
541
543
 
542
- - **ComfyUI / A1111 / SwarmUI**:参数归部署端(装了哪个 sampler、模型目录里有哪几个 checkpoint、工作流里有哪些节点),所以留「输入设置」。ComfyUI / A1111 只有「常规」参数表(外加各自的 `enum` 方框):ComfyUI 在表前多一块自定义工作流(JSON 文本框,右上角一个无边框的「插入示例模板」;填了内容后在下方出现有边框的「解析工作流」),参数行由解析产生、不显示「添加参数」;A1111 第一次展开时按内置六行 sdapi 参数预置。尺寸与质量写在 workflow / sdapi 参数里,所以没有尺寸 / 质量 / 参考图块。
544
+ - **ComfyUI / A1111 / SwarmUI**:参数归部署端(装了哪个 sampler、模型目录里有哪几个 checkpoint、工作流里有哪些节点),所以留「输入设置」。ComfyUI / A1111 使用「常规」参数表和枚举方框。ComfyUI 的参数行由工作流解析产生,尺寸和支持的质量档位通过模型选择器写入工作流。A1111 第一次展开时显示六行预置的 sdapi 参数。
543
545
  - **自配的(没有预设来源:自定义 API、中转站、老配置)**:`常规`、`模型`、各 `enum` 方框,再加 `尺寸`、`质量`、`参考图`——请求形状未知,只能用户自己定。
544
546
 
545
547
  **两块折叠区的标题行**:「输入设置」与「输出设置」是同一行结构(两块 details 直接挂在模型行上、同一份内联样式,中间不套容器;标题在左、操作区在右),左边一条基线、右边一条基线,右端的控件落同一条竖线。自配来源和相应的本地部署可同时显示两块。云端预设使用内置请求与返回格式。右端各只放一个控件或一对控件:输入那行是「一键配置」(按钮样式与模型目录的「获取可用模型」是同一个 `linkButton`)加一把整块锁(与输出那行的锁同一个图标按钮),输出那行是锁图标。展开「输入设置」后第一眼就是参数表——原来那条「说明 + 全部解锁」的工具条整行删掉了。
@@ -574,7 +576,7 @@ $DSH_HOME/.credentials.yaml
574
576
  |---|---|---|---|
575
577
  | 云端 / 中转 / 自定义 | `{ name, type, default, description, expose, options?, locked? }` | 请求体里的路径,支持 `a.b.c` 嵌套 | 手填「+ 添加参数」 |
576
578
  | A1111 / Forge / SD.Next | 同上 | sdapi 字段名(`steps`、`cfg_scale`、`sampler_name`…) | 第一次展开时按内置清单摆好六行 |
577
- | ComfyUI | 加 `node` / `input`(落在工作流节点的某个输入),`name` 只是给对话模型看的键 | 工作流里某个节点的某个输入 | 「解析工作流」自动补落点;「解析参数」把所有原始值输入列成候选,勾中即变成表行(默认值 = 当前值、类型按值推断) |
579
+ | ComfyUI | 加 `node` / `input`(落在工作流节点的某个输入),`name` 只是给对话模型看的键 | 工作流里某个节点的某个输入 | 「解析工作流」自动补齐映射和可选工作流参数 |
578
580
 
579
581
  类型只有四个:`text` / `number` / `boolean` / `enum`。`enum` 行不留在主表里——它搬进自己的方框,选项表(显示名 / 值 / 默认 / 删除)就是下拉的数据源。
580
582
 
@@ -700,4 +702,4 @@ Fireworks 和 Novita 的旧配置可以重新从目录添加新版预设以采
700
702
 
701
703
  ## License
702
704
 
703
- MIT。Codex 皮肤的几何、色板与粒子分布改编自 [dsh-codex-model-effort-selector](https://github.com/ABING1111/dsh-codex-model-effort-selector)(MIT),完整许可见 [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md)。
705
+ MIT。Codex 皮肤的几何、色板与粒子分布改编自 [dsh-codex-model-effort-selector](https://github.com/ABING1111/dsh-codex-model-effort-selector)(MIT)。项目和第三方许可见 [LICENSE](LICENSE)。
package/lib/adapters.js CHANGED
@@ -677,6 +677,12 @@ export function qualityOverrideOf(provider, model) {
677
677
 
678
678
  /** 规则 + 覆盖合并成一份质量说明;两边都没有就是"不发这个字段"。 */
679
679
  function qualitySpecFor(provider, model, adapter) {
680
+ if (adapter?.id === 'comfyui') {
681
+ const target = provider?.modelOptions?.[model]?.mapping?.quality;
682
+ const saved = target && comfyCustomWorkflow(provider, model) && qualityOverrideOf(provider, model);
683
+ if (!saved?.supported || !saved.options.length) return null;
684
+ return { ...saved, field: target.input, default: saved.options.includes(saved.default) ? saved.default : saved.options[0] };
685
+ }
680
686
  // 有实际接收档位的请求字段才提供选择器。自定义操作可以分别声明或关闭质量参数。
681
687
  let field;
682
688
  if (adapter?.id === 'custom') {
@@ -892,7 +898,8 @@ export function filterImageModels(models) {
892
898
 
893
899
  import {
894
900
  parseWorkflow, uiToApi, analyzeWorkflow, injectByMapping, applyWorkflowParams, listWorkflowInputs,
895
- PROMPT_ROLE_NAMES
901
+ findWorkflowPrompt, isManagedWorkflowInput, workflowPlaceholders, workflowInputPlaceholders, workflowReferenceTarget,
902
+ isWorkflowImagePlaceholder, workflowImageSlots, assertComfyReferenceCount, WORKFLOW_REFERENCE_LIMIT
896
903
  } from './comfy-workflow.js';
897
904
 
898
905
  const OBJECT_INFO_TTL = 5 * 60 * 1000;
@@ -1061,7 +1068,6 @@ async function comfyUploadImage(base, provider, image, signal) {
1061
1068
  const form = new FormData();
1062
1069
  form.append('image', new Blob([image.buffer], { type: image.contentType || 'image/png' }),
1063
1070
  image.filename || 'reference.png');
1064
- form.append('overwrite', 'true');
1065
1071
  const response = await requestProvider(joinEndpoint(base, '/upload/image'), {
1066
1072
  method: 'POST', headers: headersFor(provider, true), body: form, signal
1067
1073
  }, provider);
@@ -1268,16 +1274,12 @@ export const COMFY_WORKFLOW_PLACEHOLDERS = [
1268
1274
 
1269
1275
  const PLACEHOLDER_EXACT = /^\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}$/;
1270
1276
  const PLACEHOLDER_ANY = /\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g;
1271
- const COMFY_MANAGED_ROLES = ['prompt', 'negative_prompt', 'model', 'width', 'height', 'image'];
1272
-
1273
- function workflowPlaceholders(text) {
1274
- return new Set(Array.from(text.matchAll(PLACEHOLDER_ANY), (match) =>
1275
- match[1] === 'negativePrompt' ? 'negative_prompt' : match[1]));
1276
- }
1277
+ const COMFY_MANAGED_ROLES = ['prompt', 'negative_prompt', 'model', 'width', 'height', 'quality', 'image'];
1277
1278
 
1278
1279
  function placeholderError(key) {
1279
1280
  return new Error('自定义工作流里有未知占位符 {{' + key + '}};可用:'
1280
- + COMFY_WORKFLOW_PLACEHOLDERS.map((name) => '{{' + name + '}}').join('、'));
1281
+ + COMFY_WORKFLOW_PLACEHOLDERS.map((name) => '{{' + name + '}}').join('、')
1282
+ + ',或连续编号的 {{image_1}} 到 {{image_' + WORKFLOW_REFERENCE_LIMIT + '}}');
1281
1283
  }
1282
1284
 
1283
1285
  function fillString(text, values, lenient) {
@@ -1367,11 +1369,12 @@ export async function analyzeComfyWorkflow({ base, provider, workflow, signal })
1367
1369
  export async function listComfyParams({ base, provider, workflow, signal }) {
1368
1370
  const parsed = parseWorkflow(workflow);
1369
1371
  let graph = parsed.graph;
1372
+ let info;
1370
1373
  if (parsed.format === 'ui') {
1371
1374
  if (!String(base || '').trim()) {
1372
1375
  throw new Error('这是 UI 格式的工作流:解析参数要先把服务地址填好,或者改贴「导出(API)」的 JSON。');
1373
1376
  }
1374
- const info = await comfyObjectInfo(base, provider, signal);
1377
+ info = await comfyObjectInfo(base, provider, signal);
1375
1378
  const converted = uiToApi(parsed.ui, info);
1376
1379
  if (converted.missing.length) {
1377
1380
  throw new Error('工作流里的节点没有安装:' + converted.missing.join('、')
@@ -1379,13 +1382,13 @@ export async function listComfyParams({ base, provider, workflow, signal }) {
1379
1382
  }
1380
1383
  graph = converted.graph;
1381
1384
  }
1382
- const params = listWorkflowInputs(graph);
1385
+ const params = listWorkflowInputs(graph, info);
1383
1386
  return { format: parsed.format, params: params, count: params.length };
1384
1387
  }
1385
1388
 
1386
1389
  /** Protect a bound input even when the workflow parameter is listed under an alias. */
1387
1390
  export function isManagedComfyParam(param, mapping, graph) {
1388
- if (PROMPT_ROLE_NAMES.has(param?.name)) return true;
1391
+ if (isManagedWorkflowInput(param, mapping)) return true;
1389
1392
  if (param?.role && COMFY_MANAGED_ROLES.includes(param.name)) return true;
1390
1393
  if (COMFY_MANAGED_ROLES.some((role) => {
1391
1394
  const mapped = mapping?.[role];
@@ -1394,14 +1397,16 @@ export function isManagedComfyParam(param, mapping, graph) {
1394
1397
  const literal = graph?.[param?.node]?.inputs?.[param?.input];
1395
1398
  if (typeof literal !== 'string') return false;
1396
1399
  const placeholders = workflowPlaceholders(literal);
1397
- return COMFY_MANAGED_ROLES.some((role) => placeholders.has(role));
1400
+ return COMFY_MANAGED_ROLES.some((role) => placeholders.has(role))
1401
+ || [...placeholders].some(isWorkflowImagePlaceholder);
1398
1402
  }
1399
1403
 
1400
1404
  async function comfyCustomGraph(base, provider, { kind, input, model, width, height, seed, raw, signal }) {
1401
1405
  const parsed = parseWorkflow(raw);
1402
1406
  let graph = parsed.graph;
1407
+ let info;
1403
1408
  if (parsed.format === 'ui') {
1404
- const info = await comfyObjectInfo(base, provider, signal);
1409
+ info = await comfyObjectInfo(base, provider, signal);
1405
1410
  const converted = uiToApi(parsed.ui, info);
1406
1411
  if (converted.missing.length) {
1407
1412
  throw new Error('工作流里的节点没有安装:' + converted.missing.join('、')
@@ -1411,30 +1416,48 @@ async function comfyCustomGraph(base, provider, { kind, input, model, width, hei
1411
1416
  }
1412
1417
 
1413
1418
  const entry = provider && provider.modelOptions ? provider.modelOptions[model] : null;
1414
- const mapping = entry && entry.mapping ? entry.mapping : null;
1415
- const placeholders = workflowPlaceholders(raw);
1416
- const activeMapping = mapping && Object.fromEntries(Object.entries(mapping).filter(([role]) => !placeholders.has(role)));
1419
+ const mapping = entry?.mapping || {};
1420
+ const placeholders = raw.includes('{{') ? workflowInputPlaceholders(graph) : new Set();
1421
+ const activeMapping = Object.fromEntries(Object.entries(mapping).filter(([role]) => !placeholders.has(role)));
1422
+ const imageSlots = [...placeholders].some(isWorkflowImagePlaceholder) ? workflowImageSlots(graph) : [];
1423
+ if (kind === 'edit') {
1424
+ if (imageSlots.length) delete activeMapping.image;
1425
+ else {
1426
+ const target = workflowReferenceTarget(graph, activeMapping.image, info);
1427
+ if (!target) {
1428
+ throw new Error('该 ComfyUI 工作流不支持图生图:找不到可用的参考图输入。'
1429
+ + '请解析工作流,或将参考图节点的输入设为 {{image}}。');
1430
+ }
1431
+ activeMapping.image = target;
1432
+ }
1433
+ assertComfyReferenceCount(input.images?.length || 0, imageSlots.length || 1);
1434
+ }
1435
+ if (!placeholders.has('prompt')) {
1436
+ const target = activeMapping.prompt || findWorkflowPrompt(graph, info);
1437
+ if (!target || !Object.hasOwn(graph[target.node]?.inputs || {}, target.input)) {
1438
+ throw new Error('工作流中找不到可用的提示词输入。请将提示词输入设为 {{prompt}} 或重新解析工作流。');
1439
+ }
1440
+ activeMapping.prompt = target;
1441
+ }
1417
1442
  const values = {
1418
1443
  prompt: input.prompt || '',
1419
1444
  negative_prompt: input.negativePrompt || '',
1420
1445
  negativePrompt: input.negativePrompt || '',
1421
- width, height, seed, model
1446
+ width, height, seed, model,
1447
+ quality: mapQuality(provider, model, input.quality, { id: 'comfyui' })
1422
1448
  };
1423
1449
 
1424
1450
  if (kind === 'edit') {
1425
- if (!placeholders.has('image') && !activeMapping?.image) {
1426
- throw new Error('这个自定义工作流里既没有 {{image}} 占位符,也没有可用的参考图映射,不能用于图生图;'
1427
- + '请把参考图节点的 image 字段写成 {{image}},或在模型选项里解析并确认映射。');
1451
+ if (input.images.some((reference) => !reference?.buffer)) throw new Error('ComfyUI 编辑需要有效的参考图');
1452
+ for (const [index, reference] of input.images.entries()) {
1453
+ const uploaded = await comfyUploadImage(base, provider, reference, signal);
1454
+ for (const key of imageSlots[index]?.keys || ['image']) values[key] = uploaded;
1428
1455
  }
1429
- const reference = input.images && input.images[0];
1430
- if (!reference || !reference.buffer) throw new Error('ComfyUI 编辑需要一张参考图');
1431
- values.image = await comfyUploadImage(base, provider, reference, signal);
1432
1456
  }
1433
1457
 
1434
- if (!placeholders.size && !activeMapping) throw new Error('这个自定义工作流没有注入映射,请先在模型选项里解析并确认。');
1435
1458
  // 占位符必须有值,自动尺寸时使用和内置工作流一致的默认。映射仍可保留原图中的数值。
1436
1459
  let out = placeholders.size ? applyWorkflowTemplate(graph, { ...values, width: width ?? 1024, height: height ?? 1024 }) : graph;
1437
- if (activeMapping && Object.values(activeMapping).some(Boolean)) out = injectByMapping(out, activeMapping, values).graph;
1460
+ if (Object.values(activeMapping).some(Boolean)) out = injectByMapping(out, activeMapping, values).graph;
1438
1461
 
1439
1462
  // 对话模型塞进来的可调参数:认得的写进去,认不得的记下来告诉它。
1440
1463
  // 只认带节点落点的行(HTTP 参数行属于通用路径,不该在这里被当成工作流参数);
@@ -2345,6 +2368,7 @@ const ADAPTERS = [
2345
2368
  });
2346
2369
  return comfySubmitAndWait(provider, this, kind, input, built.graph, signal, hooks, built.note);
2347
2370
  }
2371
+ if (kind === 'edit') assertComfyReferenceCount(input.images?.length || 0, 1);
2348
2372
  const options = comfyOptionReader(base, provider, signal);
2349
2373
  const diffusionModels = await options('UNETLoader', 'unet_name');
2350
2374
  let workflow;