Add Nano Banana 2.1 and preserve image workflow values
This commit is contained in:
@@ -148,7 +148,7 @@ pip install -r requirements.txt --upgrade
|
|||||||
|
|
||||||
模型列表新增 `GPT Image 2.5 Sunburst`(最新,高质量)和 `GPT Image 2.5 Flare`(快速,日常)。两者与 GPT Image 2 使用相同的「智能 / 1K / 2K / 4K」分辨率和「智能、1:1、3:2、2:3、4:3、3:4、16:9、9:16」宽高比;特价、优质、企业线路分别调用模型 ID 的 `-sp`、`-sd` 和无后缀版本。下文的 GPT Image 2 参数说明也适用于这两个 GPT Image 2.5 模型。
|
模型列表新增 `GPT Image 2.5 Sunburst`(最新,高质量)和 `GPT Image 2.5 Flare`(快速,日常)。两者与 GPT Image 2 使用相同的「智能 / 1K / 2K / 4K」分辨率和「智能、1:1、3:2、2:3、4:3、3:4、16:9、9:16」宽高比;特价、优质、企业线路分别调用模型 ID 的 `-sp`、`-sd` 和无后缀版本。下文的 GPT Image 2 参数说明也适用于这两个 GPT Image 2.5 模型。
|
||||||
|
|
||||||
面板式图片生成节点统一支持 Nano Banana 系列、GPT Image 2 与 Seedream 5.0 Pro。提示词右下角使用带 `✨` 图标的「AI帮写」按钮;独立 Nano Banana 节点不再提供提示词优化按钮。参数区按“生成参数”和“保存设置”分组,采用双列网格布局;提示词独立显示为“画面描述”区域,随机种子按钮仍内嵌在种子输入框右侧。ComfyUI Nodes 1.0 因识别到 `seed` 输入而自动添加的「生成后控制」与该按钮功能重复,因此会由面板隐藏,不占用节点顶部空间。模型、线路、分辨率、宽高比、生图数量和种子常显;模型专属参数会随模型动态切换:仅 Nano Banana 2 显示「思考等级」和「在线搜索」,GPT Image 2 / 2.5 显示「质量」「背景」和「蒙版」,GPT Image 2 / 2.5 与 Seedream 5.0 Pro 都显示作为 API 参数的「输出格式」。在线搜索默认为「关闭」,关闭时不发送相关参数;选择「打开」时,请求体顶层发送 `google_search: true`。这些参数不收进高级设置弹层;切换模型只隐藏不适用参数,不会清空已选值。分辨率新增默认值「智能」;选择它时,Nano Banana、GPT Image 和 Seedream 的上游请求都不发送 `size`,由模型决定输出尺寸。选择具体档位时,GPT Image 2 会把分辨率与宽高比映射为具体像素尺寸;宽高比选择「智能」时按正方形映射为 `1024x1024 / 2048x2048 / 2880x2880`。背景支持自动、透明和不透明,输出格式支持 JPEG、PNG 和 WebP;新建 GPT 设置默认 PNG,已有工作流保留保存的格式,其中透明背景只能搭配 PNG 或 WebP。所有模型每次请求最多使用 10 张参考图。GPT Image 新选项支持每条提示词生成 1–8 张,旧工作流中的 9 张仍可执行;其余模型保持 `1 / 2 / 4 / 9`。GPT Image 2.5 的质量另支持「超高 / 最高」,分别发送 `xhigh / max`;GPT Image 2 仅支持原有四档。提示词支持用独占一行的 `---` 分隔多条内容;所有模型和执行入口都会按“提示词数量 × 生图数量”生成任务,任务排列为同一提示词的所选张数在前、下一条提示词随后,单次最多 1000 个任务。任务会按受控并发分批执行,GPT Image 与 Seedream 请求中的 `n` 固定为 `1`。模型线路在面板中显示为「特价(便宜)/ 优质(小贵)/ 企业(贵)」,工作流内部仍保存兼容值「畅速 / 直连 / 专线」;思考等级默认为「低」,显示为「低(耗时低,智力低)/ 高(耗时高,智力高)」;缩放图片显示为「不缩放(无大图)/ 智能缩放(有大图)」。带标签的下拉参数在菜单收起后也会显示当前选项的标签。
|
面板式图片生成节点统一支持 Nano Banana 系列、GPT Image 2 与 Seedream 5.0 Pro。提示词右下角使用带 `✨` 图标的「AI帮写」按钮;独立 Nano Banana 节点不再提供提示词优化按钮。参数区按“生成参数”和“保存设置”分组,采用单列参数列表,标签在左、控件在右;保留顶部批量开关、参考图区、提示词内 AI 帮写、种子右侧随机按钮和底部开始生成,控件颜色沿用当前 ComfyUI 主题,按钮不使用独立强调色;提示词独立显示为“画面描述”区域,随机种子按钮仍内嵌在种子输入框右侧。ComfyUI Nodes 1.0 因识别到 `seed` 输入而自动添加的「生成后控制」与该按钮功能重复,因此会由面板隐藏,不占用节点顶部空间。模型、线路、分辨率、宽高比、生图数量和种子常显;模型专属参数会随模型动态切换:仅 Nano Banana 2 / 2.1 显示「思考等级」和「在线搜索」,GPT Image 2 / 2.5 显示「质量」「背景」和「蒙版」,GPT Image 2 / 2.5 与 Seedream 5.0 Pro 都显示作为 API 参数的「输出格式」。在线搜索默认为「关闭」,关闭时不发送相关参数;选择「打开」时,请求体顶层发送 `google_search: true`。这些参数不收进高级设置弹层;切换模型只隐藏不适用参数,不会清空已选值。分辨率新增默认值「智能」;选择它时,Nano Banana、GPT Image 和 Seedream 的上游请求都不发送 `size`,由模型决定输出尺寸。选择具体档位时,GPT Image 2 会把分辨率与宽高比映射为具体像素尺寸;宽高比选择「智能」时按正方形映射为 `1024x1024 / 2048x2048 / 2880x2880`。背景支持自动、透明和不透明,输出格式支持 JPEG、PNG 和 WebP;新建 GPT 设置默认 PNG,已有工作流保留保存的格式,其中透明背景只能搭配 PNG 或 WebP。所有模型每次请求最多使用 10 张参考图。GPT Image 新选项支持每条提示词生成 1–8 张,旧工作流中的 9 张仍可执行;其余模型保持 `1 / 2 / 4 / 9`。GPT Image 2.5 的质量另支持「超高 / 最高」,分别发送 `xhigh / max`;GPT Image 2 仅支持原有四档。提示词支持用独占一行的 `---` 分隔多条内容;所有模型和执行入口都会按“提示词数量 × 生图数量”生成任务,任务排列为同一提示词的所选张数在前、下一条提示词随后,单次最多 1000 个任务。任务会按受控并发分批执行,GPT Image 与 Seedream 请求中的 `n` 固定为 `1`。模型线路在面板中显示为「特价(便宜)/ 优质(小贵)/ 企业(贵)」,工作流内部仍保存兼容值「畅速 / 直连 / 专线」;思考等级默认为「低」,显示为「低(耗时低,智力低)/ 高(耗时高,智力高)」;缩放图片显示为「不缩放(无大图)/ 智能缩放(有大图)」。带标签的下拉参数在菜单收起后也会显示当前选项的标签。 同一面板支持 Nodes 1.0 / 2.0 切换,参数、参考图和操作位置保持不变。
|
||||||
|
|
||||||
Seedream 5.0 Pro 位于 GPT Image 2 下方,支持「智能 / 1K / 2K」分辨率与「智能、1:1、4:3、3:4、16:9、9:16、3:2、2:3、21:9」宽高比;具体档位会转换为接口要求的精确像素尺寸。参考图通过当前全局线路的 `/v1/o1key/uploads` 上传为临时 HTTPS URL,再按原顺序传入 `images`。输出格式实际发送 `output_format=png/jpeg`;水印不提供界面开关,固定发送 `watermark=false`。
|
Seedream 5.0 Pro 位于 GPT Image 2 下方,支持「智能 / 1K / 2K」分辨率与「智能、1:1、4:3、3:4、16:9、9:16、3:2、2:3、21:9」宽高比;具体档位会转换为接口要求的精确像素尺寸。参考图通过当前全局线路的 `/v1/o1key/uploads` 上传为临时 HTTPS URL,再按原顺序传入 `images`。输出格式实际发送 `output_format=png/jpeg`;水印不提供界面开关,固定发送 `watermark=false`。
|
||||||
|
|
||||||
@@ -195,12 +195,20 @@ Nano Banana 与 GPT Image 2 的最终 UTF-8 JSON 请求体(含 Base64)都按
|
|||||||
|
|
||||||
本地「格式」只在 Banana 模型下显示,默认「原始」,也可选 `PNG / JPEG / WebP`;它控制保存时是否转换容器。Nano Banana 不接收 `output_format`,所以模型返回 PNG 就保留 PNG,返回 JPEG 就保留 JPEG,除非这里显式转换。GPT Image 2 不使用这个本地参数,而使用独立的 API「输出格式」;可选 `JPEG / PNG / WebP`,默认 `JPEG`,实际请求值为小写 `jpeg`。Seedream 同样使用 API「输出格式」,只提供 `PNG / JPEG`,并按所选值保存上游原始容器。透明背景仍只支持 GPT Image 的 PNG 或 WebP。保存节点写入可恢复工作流时遵循 ComfyUI 原生图片元数据约定:PNG 保存 `prompt` 和 `workflow` 文本块;由于 ComfyUI 不从 JPEG 读取工作流且 JPEG EXIF 容量有限,带工作流的 JPEG 来源或 JPEG 保存选项会自动落盘为 PNG。将该 PNG 拖回或载入 ComfyUI 即可恢复工作流;关闭 ComfyUI 全局元数据写入时仍按所选 JPEG 保存,但不会附带工作流。
|
本地「格式」只在 Banana 模型下显示,默认「原始」,也可选 `PNG / JPEG / WebP`;它控制保存时是否转换容器。Nano Banana 不接收 `output_format`,所以模型返回 PNG 就保留 PNG,返回 JPEG 就保留 JPEG,除非这里显式转换。GPT Image 2 不使用这个本地参数,而使用独立的 API「输出格式」;可选 `JPEG / PNG / WebP`,默认 `JPEG`,实际请求值为小写 `jpeg`。Seedream 同样使用 API「输出格式」,只提供 `PNG / JPEG`,并按所选值保存上游原始容器。透明背景仍只支持 GPT Image 的 PNG 或 WebP。保存节点写入可恢复工作流时遵循 ComfyUI 原生图片元数据约定:PNG 保存 `prompt` 和 `workflow` 文本块;由于 ComfyUI 不从 JPEG 读取工作流且 JPEG EXIF 容量有限,带工作流的 JPEG 来源或 JPEG 保存选项会自动落盘为 PNG。将该 PNG 拖回或载入 ComfyUI 即可恢复工作流;关闭 ComfyUI 全局元数据写入时仍按所选 JPEG 保存,但不会附带工作流。
|
||||||
|
|
||||||
生成参数使用适合中英文与数字混排的字体、字距和垂直居中的下拉箭头;模型列表会显示用途说明。新建节点默认尺寸为 `560 × 1035`,提示词框约显示 5 行内容;开启批量出图或切换到参数较多的 GPT Image 2 时,节点会增加高度以容纳额外控件。`Nano Banana 2` 提供 `1K / 2K / 4K` 分辨率,不再提供 `512`。批次提交后,「o1key 保存图像」会立即按实际任务展开顺序排列固定图片槽位;每张图片完整下载到 ComfyUI `temp` 后会立即显示在对应槽位,无需等待整批完成,全部成功后再切回 ComfyUI 原生图片预览并按设置永久保存。拖动保存节点改变宽度或高度时,原生单图和多图预览会同步使用全部可用区域重新排布并等比缩放,不裁切图片,也不保留旧节点尺寸产生的固定空白。若部分图片失败,成功图仍保留在原序号位置,失败槽位显示独立重试按钮;不同失败槽位可以连续点击并行重试,每个槽位只重新提交自己的原提示词和原素材组合,先完成的重试不会结束或覆盖仍在运行的其他槽位。槽位状态和安全的结果描述会随工作流保存、刷新恢复,且槽位视图与原生预览不会同时叠加。原生下载按钮会替换为白底黑色的重新生成图标;在全成功的多图结果中先选中目标图片,再点击该图标,即可沿用当前参数和新的随机种子只生成 1 张新图,且不会修改生成面板中原来选择的生图数量。生成过程中仍保留顶部细进度条,不显示百分比文案。
|
生成参数沿用 ComfyUI 主题颜色,使用垂直居中的下拉箭头;模型列表会显示用途说明。新建节点默认尺寸为 `560 × 1035`,提示词框约显示 5 行内容;开启批量出图或切换到参数较多的 GPT Image 2 时,节点会增加高度以容纳额外控件。`Nano Banana 2 / 2.1` 提供 `1K / 2K / 4K` 分辨率,不再提供 `512`。批次提交后,「o1key 保存图像」会立即按实际任务展开顺序排列固定图片槽位;每张图片完整下载到 ComfyUI `temp` 后会立即显示在对应槽位,无需等待整批完成,全部成功后再切回 ComfyUI 原生图片预览并按设置永久保存。拖动保存节点改变宽度或高度时,原生单图和多图预览会同步使用全部可用区域重新排布并等比缩放,不裁切图片,也不保留旧节点尺寸产生的固定空白。若部分图片失败,成功图仍保留在原序号位置,失败槽位显示独立重试按钮;不同失败槽位可以连续点击并行重试,每个槽位只重新提交自己的原提示词和原素材组合,先完成的重试不会结束或覆盖仍在运行的其他槽位。槽位状态和安全的结果描述会随工作流保存、刷新恢复,且槽位视图与原生预览不会同时叠加。原生下载按钮会替换为白底黑色的重新生成图标;在全成功的多图结果中先选中目标图片,再点击该图标,即可沿用当前参数和新的随机种子只生成 1 张新图,且不会修改生成面板中原来选择的生图数量。生成过程中仍保留顶部细进度条,不显示百分比文案。
|
||||||
|
|
||||||
旧工作流加载时,会把保存节点原有的「文件名前缀 / 格式 / 保存位置 / 命名规则」迁移到相连的「o1key 图片生成」节点;保存节点自身的旧控件值随后清除。迁移不会改动节点 ID 或图像连线。
|
旧工作流加载时,会把保存节点原有的「文件名前缀 / 格式 / 保存位置 / 命名规则」迁移到相连的「o1key 图片生成」节点;保存节点自身的旧控件值随后清除。迁移不会改动节点 ID 或图像连线。
|
||||||
|
|
||||||
### Nano Banana / Nano Banana 批量跑图
|
### Nano Banana / Nano Banana 批量跑图
|
||||||
|
|
||||||
|
「Nano Banana」「Nano Banana 批量跑图」和「o1key 图片生成」均新增 `Nano Banana 2.1`,并将其设为新建节点的默认模型;已有工作流保留原来的模型选择。2.1 沿用 Nano Banana 2 的思考等级、在线搜索(统一图片生成节点)和扩展宽高比,提供 `1K / 2K / 4K`;统一图片生成节点还支持「智能」分辨率。
|
||||||
|
|
||||||
|
| 模型线路展示名 | 工作流线路值 | Nano Banana 2.1 API 模型 ID |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 特价 | 畅速 | `gemini-nano-banana-2.1-sp` |
|
||||||
|
| 优质 | 直连 | `gemini-nano-banana-2.1-sd` |
|
||||||
|
| 企业 | 专线 | `gemini-nano-banana-2.1` |
|
||||||
|
|
||||||
两个独立 Nano Banana 节点与「o1key 图片生成」复用同一套异步请求、18 MiB 请求体检查、任务查询恢复和结果下载校验。两个节点使用手写提示词,不再提供提示词优化按钮。
|
两个独立 Nano Banana 节点与「o1key 图片生成」复用同一套异步请求、18 MiB 请求体检查、任务查询恢复和结果下载校验。两个节点使用手写提示词,不再提供提示词优化按钮。
|
||||||
|
|
||||||
「缩放图片」默认为「不缩放」:最终 UTF-8 JSON 请求体超过 18 MiB 时会在付费请求前拒绝;选择「智能缩放」后会使用 Lanczos 等比缩小占用最大的参考图,直至请求体满足限制。两个 Nano Banana 节点均不提供色彩纠正。
|
「缩放图片」默认为「不缩放」:最终 UTF-8 JSON 请求体超过 18 MiB 时会在付费请求前拒绝;选择「智能缩放」后会使用 Lanczos 等比缩小占用最大的参考图,直至请求体满足限制。两个 Nano Banana 节点均不提供色彩纠正。
|
||||||
|
|||||||
@@ -150,6 +150,10 @@ The generator's local `格式` input defaults to `原始` and is visible only fo
|
|||||||
|
|
||||||
The panel displays model-route labels as `特价 / 优质 / 企业`, but serializes and submits the established internal values `畅速 / 直连 / 专线`. This label/value separation is mandatory: changing the serialized values would require a workflow migration and provider-matrix compatibility work.
|
The panel displays model-route labels as `特价 / 优质 / 企业`, but serializes and submits the established internal values `畅速 / 直连 / 专线`. This label/value separation is mandatory: changing the serialized values would require a workflow migration and provider-matrix compatibility work.
|
||||||
|
|
||||||
|
The unified image generator retains its DOM panel, grouped sections, top batch controls, reference upload/canvas-picker header, empty add-reference tile, prompt-local AI writing action, inline seed randomizer, and bottom generate action. The released schema widgets remain hidden and provide the stable execution/serialization boundary. CSS presents generation/save parameters in one vertical list with left labels and right controls. Nodes 1.0 uses ComfyUI input theme tokens; inside the Nodes 2.0 widget host it uses component-node tokens. All buttons use the same neutral theme surface as the inputs. Switching renderers retains the same panel and values; it does not replace the panel with native schema widgets or append action rows.
|
||||||
|
|
||||||
|
LiteGraph includes `serialize:false` UI widgets in workflow arrays, even though prompt serialization omits them. The generator serializes only its ordered backend widget values, excluding the hidden automatic seed control and the panel widget. The seed randomizer remains inside its input row. Old hidden `control_after_generate` values after `seed` and the full-layout trailing empty panel value are removed by narrow idempotent migrations, including inside subgraphs. Node/input/output IDs and provider payloads stay unchanged. [ADR 0015](decisions/0015-image-generator-workflow-values.md) records this compatibility boundary.
|
||||||
|
|
||||||
The panel's `prompt` remains a socketless, serialized widget value edited in the node. The removed `external_prompt` input is not part of the V3 schema or execution signature. Before loading an older workflow, the frontend migration removes that input and its exact graph link from the generator, the link table, and the source output while retaining the saved panel prompt text. It is idempotent and applies inside subgraph definitions as well as the root graph.
|
The panel's `prompt` remains a socketless, serialized widget value edited in the node. The removed `external_prompt` input is not part of the V3 schema or execution signature. Before loading an older workflow, the frontend migration removes that input and its exact graph link from the generator, the link table, and the source output while retaining the saved panel prompt text. It is idempotent and applies inside subgraph definitions as well as the root graph.
|
||||||
|
|
||||||
The unified generator accepts at most ten references in one provider request and offers GPT Image counts 1–8 (retaining saved 9-image jobs) and other-model counts `1 / 2 / 4 / 9`. Batch source and target manifests may each contain up to fifty images when the active pairing mode sends only one source or target per request; group mode still caps its source manifest at nine because it appends one target to the same ten-reference request. A prompt field containing `---` on a line by itself expands into prompt-major tasks. The unified boundary rejects more than 1000 tasks before any paid request, and background/direct GPT and Seedream execution keeps at most nine provider requests in flight per batch. Every GPT Image and Seedream request sends `n=1`; the outer scheduler owns concurrency and partial-result isolation.
|
The unified generator accepts at most ten references in one provider request and offers GPT Image counts 1–8 (retaining saved 9-image jobs) and other-model counts `1 / 2 / 4 / 9`. Batch source and target manifests may each contain up to fifty images when the active pairing mode sends only one source or target per request; group mode still caps its source manifest at nine because it appends one target to the same ten-reference request. A prompt field containing `---` on a line by itself expands into prompt-major tasks. The unified boundary rejects more than 1000 tasks before any paid request, and background/direct GPT and Seedream execution keeps at most nine provider requests in flight per batch. Every GPT Image and Seedream request sends `n=1`; the outer scheduler owns concurrency and partial-result isolation.
|
||||||
@@ -188,7 +192,7 @@ The exact compact UTF-8 request JSON for both Nano Banana and unified-node GPT I
|
|||||||
|
|
||||||
`O1keyImageGenerator`, `NanoBanana`, `BatchNanoBananaPro`, and `O1keyGPTImage` no longer expose or apply reference-guided colour correction. The frontend migration removes their former serialized correction values before ComfyUI maps positional widget arrays, preserving the settings that followed them. `O1keyGPTImageBatch` retains its correction control and uses `reference_color_correction.py` for batch outputs.
|
`O1keyImageGenerator`, `NanoBanana`, `BatchNanoBananaPro`, and `O1keyGPTImage` no longer expose or apply reference-guided colour correction. The frontend migration removes their former serialized correction values before ComfyUI maps positional widget arrays, preserving the settings that followed them. `O1keyGPTImageBatch` retains its correction control and uses `reference_color_correction.py` for batch outputs.
|
||||||
|
|
||||||
GPT Image sizing is represented in the unified panel as separate resolution (`智能 / 1K / 2K / 4K`) and aspect-ratio controls. Resolution defaults to `智能`; all three unified provider families omit `size` at that value. `o1key_image_catalog.py` owns the mapping from an explicit tier plus ratio to the exact GPT pixel size; `智能` aspect ratio deliberately selects the square size for the chosen explicit tier (`1024x1024 / 2048x2048 / 2880x2880`) rather than sending a bare tier label, while legacy standalone GPT nodes keep their combined size labels. Active user controls are rendered as a single vertical list, with a fixed label column on the left and the control column on the right, and filtered through a frontend model-capability matrix: thinking level and online search are Nano Banana 2-only; resize mode is available to Nano Banana and GPT Image; API output format is available to GPT Image and Seedream; and quality, background, moderation, plus mask are GPT Image-only. Switching models updates existing field visibility without recreating controls, so model-specific values survive a round trip. Online search is omitted by default and becomes the top-level provider field `google_search: true` only when enabled for Nano Banana 2. Transport-only manifest widgets remain hidden. Nodes 1.0 group conversion automatically injects a `control_after_generate` widget for inputs named `seed` or `noise_seed`; the unified panel hides that generated widget because its embedded seed randomizer is the sole visible authority, while retaining the released `seed` input ID and serialized value for workflow compatibility. GPT Image background values (`auto / transparent / opaque`) and output formats (`png / webp / jpeg`) are validated before a paid request and travel unchanged through both direct execution and background jobs; `transparent` is rejected with `jpeg`, and the frontend removes JPEG from the available formats while transparency is selected. Seedream validates `png / jpeg` and hides unsupported GPT-only controls. Moderation accepts only the UI values `自动 / 低`; `自动` omits the provider parameter and `低` sends `moderation: "low"`.
|
GPT Image sizing is represented in the unified panel as separate resolution (`智能 / 1K / 2K / 4K`) and aspect-ratio controls. Resolution defaults to `智能`; all three unified provider families omit `size` at that value. `o1key_image_catalog.py` owns the mapping from an explicit tier plus ratio to the exact GPT pixel size; `智能` aspect ratio deliberately selects the square size for the chosen explicit tier (`1024x1024 / 2048x2048 / 2880x2880`) rather than sending a bare tier label, while legacy standalone GPT nodes keep their combined size labels. Active user controls are rendered as a single vertical list, with a fixed label column on the left and the control column on the right, and filtered through a frontend model-capability matrix: thinking level and online search are available to Nano Banana 2 and 2.1; resize mode is available to Nano Banana and GPT Image; API output format is available to GPT Image and Seedream; and quality, background, moderation, plus mask are GPT Image-only. Switching models updates existing field visibility without recreating controls, so model-specific values survive a round trip. Online search is omitted by default and becomes the top-level provider field `google_search: true` only when enabled for Nano Banana 2 or 2.1. Transport-only manifest widgets remain hidden. Nodes 1.0 group conversion automatically injects a `control_after_generate` widget for inputs named `seed` or `noise_seed`; the unified panel hides that generated widget because its embedded seed randomizer is the sole visible authority, while retaining the released `seed` input ID and serialized value for workflow compatibility. GPT Image background values (`auto / transparent / opaque`) and output formats (`png / webp / jpeg`) are validated before a paid request and travel unchanged through both direct execution and background jobs; `transparent` is rejected with `jpeg`, and the frontend removes JPEG from the available formats while transparency is selected. Seedream validates `png / jpeg` and hides unsupported GPT-only controls. Moderation accepts only the UI values `自动 / 低`; `自动` omits the provider parameter and `低` sends `moderation: "low"`.
|
||||||
|
|
||||||
The unified image prompt editor's visible `AI帮写` action calls the compatibility route `POST /o1key/image/prompt-optimize`. The browser sends only the current prompt and sanitized ComfyUI input descriptors; the server resolves those paths inside the input root, creates ordered analysis images, and calls `gpt-5.6-sol` with `reasoning_effort=high` through the configured O1Key route. The request is non-streaming and uses a dedicated system instruction that prioritizes binding visual attributes to concrete subjects before expressing preserve/change directives. Reference analysis images use exact `image/jpeg` data URLs and the compact request body is capped at 18 MiB. API credentials remain server-side, and neither request bodies nor base64 image data may be logged.
|
The unified image prompt editor's visible `AI帮写` action calls the compatibility route `POST /o1key/image/prompt-optimize`. The browser sends only the current prompt and sanitized ComfyUI input descriptors; the server resolves those paths inside the input root, creates ordered analysis images, and calls `gpt-5.6-sol` with `reasoning_effort=high` through the configured O1Key route. The request is non-streaming and uses a dedicated system instruction that prioritizes binding visual attributes to concrete subjects before expressing preserve/change directives. Reference analysis images use exact `image/jpeg` data URLs and the compact request body is capped at 18 MiB. API credentials remain server-side, and neither request bodies nor base64 image data may be logged.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# 0015: Canonical image-generator workflow values
|
||||||
|
|
||||||
|
- Status: Accepted
|
||||||
|
- Date: 2026-10-07
|
||||||
|
- Owners: Maintainers
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
The image generator uses a custom panel over hidden schema widgets. LiteGraph includes hidden automatic seed controls and the panel value in positional workflow arrays, even for UI widgets marked non-serialized. These values can shift reference manifests and later save settings while restoring workflows.
|
||||||
|
|
||||||
|
## Decision
|
||||||
|
|
||||||
|
Keep the existing panel, interaction hierarchy, node IDs, and input order. Serialize only ordered backend widget values. Before existing workflow migrations run, remove an automatic seed-control value only when it follows the numeric seed and precedes a reference-list string. Remove the trailing empty panel value only from the recognized full 24-value layout. Repeat these checks inside subgraphs.
|
||||||
|
|
||||||
|
## Consequences
|
||||||
|
|
||||||
|
Panel controls and their positions remain unchanged. Newly saved workflows have exactly the schema's 23 values. Older panel workflows and workflows saved during the native-widget revision restore the same parameters, reference manifests, and save settings.
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
|
||||||
|
Offline tests cover panel action placement, idempotent creation, canonical serialization, and repeated root/subgraph migration. Browser checks retain parameters and references across both renderers without paid generation.
|
||||||
@@ -26,3 +26,4 @@ Use ADRs for decisions that constrain future changes: node ID compatibility, pac
|
|||||||
- [0012: Place batch Nano Banana save settings and seed last](0012-batch-nano-save-and-seed-widget-order.md)
|
- [0012: Place batch Nano Banana save settings and seed last](0012-batch-nano-save-and-seed-widget-order.md)
|
||||||
- [0013: Remove batch Nano Banana random image selection](0013-remove-batch-nano-random-image-selection.md)
|
- [0013: Remove batch Nano Banana random image selection](0013-remove-batch-nano-random-image-selection.md)
|
||||||
- [0014: Publish the current code as a new release baseline](0014-new-release-code-baseline.md)
|
- [0014: Publish the current code as a new release baseline](0014-new-release-code-baseline.md)
|
||||||
|
- [0015: Canonical image-generator workflow values](0015-image-generator-workflow-values.md)
|
||||||
|
|||||||
+5
-1
@@ -54,6 +54,8 @@ For Omni Flash, keep `O1keyOmniFlashVideo` as the sole node ID. Its `execute` va
|
|||||||
- Add or extend a Node-based test for logic that can run without a browser.
|
- Add or extend a Node-based test for logic that can run without a browser.
|
||||||
- For display-only Combo aliases, set `widget.options.getOptionLabel` in an idempotent frontend extension; keep the actual option values unchanged so prompt payloads and saved workflows remain compatible.
|
- For display-only Combo aliases, set `widget.options.getOptionLabel` in an idempotent frontend extension; keep the actual option values unchanged so prompt payloads and saved workflows remain compatible.
|
||||||
|
|
||||||
|
For the image generator, preserve the existing DOM panel and its interaction hierarchy. Keep batch controls and reference upload actions at the top, AI writing inside the prompt area, the randomizer inside the seed row, and generation at the bottom. Restrict style requests to CSS: a single parameter column with left labels/right controls and current ComfyUI theme colours, without button accents. Use legacy input tokens outside the Nodes 2.0 widget host and component-node tokens inside it. Keep backend widgets hidden in both renderers, reapply visibility when renderer options are replaced, and never reorder schema widgets. Serialize only ordered backend values so hidden seed controls and the panel cannot shift later settings. Cover panel identity/action placement, renderer visibility, model switching, and root/subgraph migration with the offline frontend test; compare both renderers and themes using a disposable browser workflow.
|
||||||
|
|
||||||
Panel-triggered image batches must be represented in ComfyUI's native task queue, not by task-state text or a cancel action inside `O1keyImageGenerator`. Keep the jobs API bridge idempotent, retain a distinct queue item and expected-output count per batch, route native single and bulk cancellation to `/o1key/image/jobs/{batch_id}/cancel`, and leave the generator action available for consecutive submissions. Preserve native queue/history records returned by ComfyUI when merging o1key records, hydrate persisted terminal summaries before returning the first history page, and keep queue clearing semantics limited to waiting batches. History persistence must remain bounded, atomic, credential-free, and synchronized with native delete/clear actions; a persistence failure must never change the result of a paid generation or successful image save.
|
Panel-triggered image batches must be represented in ComfyUI's native task queue, not by task-state text or a cancel action inside `O1keyImageGenerator`. Keep the jobs API bridge idempotent, retain a distinct queue item and expected-output count per batch, route native single and bulk cancellation to `/o1key/image/jobs/{batch_id}/cancel`, and leave the generator action available for consecutive submissions. Preserve native queue/history records returned by ComfyUI when merging o1key records, hydrate persisted terminal summaries before returning the first history page, and keep queue clearing semantics limited to waiting batches. History persistence must remain bounded, atomic, credential-free, and synchronized with native delete/clear actions; a persistence failure must never change the result of a paid generation or successful image save.
|
||||||
|
|
||||||
`O1keyVideoGenerator` is intentionally different from the image generator: its panel jobs must not enter or imitate ComfyUI's native queue. Keep paid work exclusively behind `/o1key/video/jobs`; native generator execution may resolve completed local descriptors but must never submit or retry generation. One click must create one connected native `SaveVideo`, plus one connected native `SaveImage` only when `return_last_frame` is enabled, and one independent server job record. Dispatch completed safe descriptors to those exact native nodes and persist enough safe association state to restore previews or resume polling after workflow reload. Keep the released `O1keyVideoResult` registered as deprecated compatibility support, but never create it for new panel submissions. Re-enable the action as soon as submission returns so later clicks remain independent. Provider adapters belong behind `o1key_video_catalog.py` and `o1key_video_jobs.py`: add the capability entry, scalar/media validation, request-body builder, executor dispatch, frontend controls, and offline tests together. Seedance automatic material creation must go through `seedance_assets.py`, map the video route to the matching HC or Doubao asset namespace, wait for `Active`, and submit `asset://` references only. Keep material concurrency bounded independently of video-job concurrency, preserve input order after concurrent preparation, and let terminal results retain only safe resolved IDs so retries do not recreate assets. Content reuse may persist fingerprints and IDs, but never upload URLs, local paths, credentials, or complete provider envelopes. Validate all limits before uploads or paid requests, snapshot only sanitized Comfy input descriptors, and persist neither credentials, Base64, signed URLs, nor absolute input paths.
|
`O1keyVideoGenerator` is intentionally different from the image generator: its panel jobs must not enter or imitate ComfyUI's native queue. Keep paid work exclusively behind `/o1key/video/jobs`; native generator execution may resolve completed local descriptors but must never submit or retry generation. One click must create one connected native `SaveVideo`, plus one connected native `SaveImage` only when `return_last_frame` is enabled, and one independent server job record. Dispatch completed safe descriptors to those exact native nodes and persist enough safe association state to restore previews or resume polling after workflow reload. Keep the released `O1keyVideoResult` registered as deprecated compatibility support, but never create it for new panel submissions. Re-enable the action as soon as submission returns so later clicks remain independent. Provider adapters belong behind `o1key_video_catalog.py` and `o1key_video_jobs.py`: add the capability entry, scalar/media validation, request-body builder, executor dispatch, frontend controls, and offline tests together. Seedance automatic material creation must go through `seedance_assets.py`, map the video route to the matching HC or Doubao asset namespace, wait for `Active`, and submit `asset://` references only. Keep material concurrency bounded independently of video-job concurrency, preserve input order after concurrent preparation, and let terminal results retain only safe resolved IDs so retries do not recreate assets. Content reuse may persist fingerprints and IDs, but never upload URLs, local paths, credentials, or complete provider envelopes. Validate all limits before uploads or paid requests, snapshot only sanitized Comfy input descriptors, and persist neither credentials, Base64, signed URLs, nor absolute input paths.
|
||||||
@@ -72,13 +74,15 @@ When changing `O1keyImageSave`, preserve the mutually-exclusive preview rules do
|
|||||||
|
|
||||||
When adding a model to `O1keyImageGenerator`, update `utils/o1key_image_catalog.py`, the frontend model descriptions/capability switch, the job payload validator, and the model-family executor together. Preserve the existing route values even when their labels change. Provider-specific multi-image parameters must not bypass the unified scheduler: each selected output image is one concurrent provider request, and GPT Image always receives `n=1`. Keep GPT-only controls appended after the original generator widgets so old workflow arrays do not shift.
|
When adding a model to `O1keyImageGenerator`, update `utils/o1key_image_catalog.py`, the frontend model descriptions/capability switch, the job payload validator, and the model-family executor together. Preserve the existing route values even when their labels change. Provider-specific multi-image parameters must not bypass the unified scheduler: each selected output image is one concurrent provider request, and GPT Image always receives `n=1`. Keep GPT-only controls appended after the original generator widgets so old workflow arrays do not shift.
|
||||||
|
|
||||||
|
`utils/nano_banana_models.py` owns the shared Nano Banana model list and route IDs for `NanoBanana`, `BatchNanoBananaPro`, and unified image generation. `Nano Banana 2.1` is first in the model lists and the default in all three schemas, the unified execution method, and frontend fallbacks. Its `畅速 / 直连 / 专线` IDs are `gemini-nano-banana-2.1-sp / gemini-nano-banana-2.1-sd / gemini-nano-banana-2.1`; it shares Nano Banana 2's thinking, online-search, and extended-aspect-ratio support. Keep saved model selections intact, and include every new model in the migration model-recognition set without changing widget order. Verify model IDs, defaults, and parameter forwarding with the Nano Banana dynamic-input, unified image-generator, image-job, and image-generator frontend tests.
|
||||||
|
|
||||||
For Seedream, keep the stable workflow value `Seedream 5.0 Pro` separate from API model ID `dola-seedream-5-0-pro-260628-ep`. Treat the unified panel's default `智能` resolution as an omitted provider `size`; resolve explicit `1K / 2K` plus aspect ratio through the catalog's exact size matrix, submit one image per async task with `n=1`, pass the selected `png / jpeg` as `output_format`, and always send `watermark=false` without adding a widget. Upload ordered references through `{base_url}/v1/o1key/uploads` and submit only the returned HTTPS URL strings; never log those temporary URLs. Layer decomposition is the exception to the normal size/prompt rules: accept exactly one reference, optional prompt text, `智能 / 1K / 1.5K / 2K`, forced PNG, and no batching. Keep all returned images in `z_index` order, preserve transparent provider bytes, expose alpha as MASK in direct execution, and sanitize metadata before it reaches descriptors, history, or workflows.
|
For Seedream, keep the stable workflow value `Seedream 5.0 Pro` separate from API model ID `dola-seedream-5-0-pro-260628-ep`. Treat the unified panel's default `智能` resolution as an omitted provider `size`; resolve explicit `1K / 2K` plus aspect ratio through the catalog's exact size matrix, submit one image per async task with `n=1`, pass the selected `png / jpeg` as `output_format`, and always send `watermark=false` without adding a widget. Upload ordered references through `{base_url}/v1/o1key/uploads` and submit only the returned HTTPS URL strings; never log those temporary URLs. Layer decomposition is the exception to the normal size/prompt rules: accept exactly one reference, optional prompt text, `智能 / 1K / 1.5K / 2K`, forced PNG, and no batching. Keep all returned images in `z_index` order, preserve transparent provider bytes, expose alpha as MASK in direct execution, and sanitize metadata before it reaches descriptors, history, or workflows.
|
||||||
|
|
||||||
Keep batch-prompt behavior model-independent. A `---` line is the only prompt separator, task order is prompt-major, and both direct execution and panel background jobs must calculate `valid prompt segments × pairing count × images per pair` and reject totals above the shared 1000-task ceiling before provider calls. Pairing count is one in normal mode. Panel background jobs and direct execution limit each batch to nine in-flight provider requests.
|
Keep batch-prompt behavior model-independent. A `---` line is the only prompt separator, task order is prompt-major, and both direct execution and panel background jobs must calculate `valid prompt segments × pairing count × images per pair` and reject totals above the shared 1000-task ceiling before provider calls. Pairing count is one in normal mode. Panel background jobs and direct execution limit each batch to nine in-flight provider requests.
|
||||||
|
|
||||||
Do not add a download semaphore or an independent download-concurrency limit to `O1keyImageGenerator`. Ready result URLs must download immediately; the active provider-task scheduler is the only natural bound. The shared Nano transport may retain its optional semaphore for other released nodes, but unified direct and background paths must pass no limiter.
|
Do not add a download semaphore or an independent download-concurrency limit to `O1keyImageGenerator`. Ready result URLs must download immediately; the active provider-task scheduler is the only natural bound. The shared Nano transport may retain its optional semaphore for other released nodes, but unified direct and background paths must pass no limiter.
|
||||||
|
|
||||||
For GPT Image, keep resolution/aspect-ratio pairs in the catalog size matrix rather than duplicating exact pixel labels in the panel. `智能` is the first and default unified resolution for every model; it must become `None` at the provider boundary so Nano Banana, GPT Image, and Seedream request builders omit `size` entirely. Explicit tiers retain their existing mappings. Keep active user controls in one persistent vertical list with labels on the left and controls on the right, but apply the model capability matrix when synchronizing the model: thinking level and online search are Nano Banana 2-only, resize mode is shared by Nano and GPT Image, and quality, background, API output format, plus mask are GPT Image-only. Online search defaults to `关闭`; omit `google_search` unless it is `打开`, then submit top-level `google_search: true`. The local `格式` field is visible only for Banana models; `命名规则`, `filename_prefix`, and `保存位置` are shared. Hide unsupported fields in place instead of rebuilding them so values and listeners survive model switching. Display `JPEG` but serialize and submit lowercase `jpeg`; new GPT panel selections use `png` while saved values remain intact. Reject `transparent + jpeg` before any paid request and keep JPEG out of the frontend list while transparency is active.
|
For GPT Image, keep resolution/aspect-ratio pairs in the catalog size matrix rather than duplicating exact pixel labels in the panel. `智能` is the first and default unified resolution for every model; it must become `None` at the provider boundary so Nano Banana, GPT Image, and Seedream request builders omit `size` entirely. Explicit tiers retain their existing mappings. Keep active user controls in one persistent vertical list with labels on the left and controls on the right, but apply the model capability matrix when synchronizing the model: thinking level and online search are available to Nano Banana 2 and 2.1, resize mode is shared by Nano and GPT Image, and quality, background, API output format, plus mask are GPT Image-only. Online search defaults to `关闭`; omit `google_search` unless it is `打开`, then submit top-level `google_search: true`. The local `格式` field is visible only for Banana models; `命名规则`, `filename_prefix`, and `保存位置` are shared. Hide unsupported fields in place instead of rebuilding them so values and listeners survive model switching. Display `JPEG` but serialize and submit lowercase `jpeg`; new GPT panel selections use `png` while saved values remain intact. Reject `transparent + jpeg` before any paid request and keep JPEG out of the frontend list while transparency is active.
|
||||||
|
|
||||||
Keep prompt writing behind dedicated server routes. The unified image and video prompt actions must retain both the magic-wand icon and the visible `AI帮写` label so their purpose is understandable without hover; the image compatibility route remains `/o1key/image/prompt-optimize`, while video uses `/o1key/video/prompt-write` and a separate video-only system preset. The frontend must submit input descriptors rather than API credentials or filesystem paths. The server must enforce the input-root boundary, preserve reference order, cap the exact multimodal request body, use `gpt-5.6-sol` with high reasoning, and return only the optimized prompt. Tests must mock the upstream completion call and generate reference images at runtime; never add encoded reference fixtures or log complete data URLs.
|
Keep prompt writing behind dedicated server routes. The unified image and video prompt actions must retain both the magic-wand icon and the visible `AI帮写` label so their purpose is understandable without hover; the image compatibility route remains `/o1key/image/prompt-optimize`, while video uses `/o1key/video/prompt-write` and a separate video-only system preset. The frontend must submit input descriptors rather than API credentials or filesystem paths. The server must enforce the input-root boundary, preserve reference order, cap the exact multimodal request body, use `gpt-5.6-sol` with high reasoning, and return only the optimized prompt. Tests must mock the upstream completion call and generate reference images at runtime; never add encoded reference fixtures or log complete data URLs.
|
||||||
|
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ class BatchNanoBananaPro(io.ComfyNode):
|
|||||||
# Nano Banana 2 系列特有的宽高比
|
# Nano Banana 2 系列特有的宽高比
|
||||||
nano_2_exclusive_ratios = {"1:4", "1:8", "4:1", "8:1"}
|
nano_2_exclusive_ratios = {"1:4", "1:8", "4:1", "8:1"}
|
||||||
# 其他模型使用了 Nano Banana 2 系列专属宽高比
|
# 其他模型使用了 Nano Banana 2 系列专属宽高比
|
||||||
if model_name not in {"Nano Banana 2", "Nano Banana 2 Lite"} and aspect_ratio in nano_2_exclusive_ratios:
|
if model_name not in {"Nano Banana 2.1", "Nano Banana 2", "Nano Banana 2 Lite"} and aspect_ratio in nano_2_exclusive_ratios:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"宽高比 {aspect_ratio} 仅支持 Nano Banana 2 系列模型,"
|
f"宽高比 {aspect_ratio} 仅支持 Nano Banana 2 系列模型,"
|
||||||
f"当前模型 {model_name} 不支持此宽高比"
|
f"当前模型 {model_name} 不支持此宽高比"
|
||||||
@@ -463,7 +463,7 @@ class BatchNanoBananaPro(io.ComfyNode):
|
|||||||
default="一个中国女子的OOTD",
|
default="一个中国女子的OOTD",
|
||||||
multiline=True,
|
multiline=True,
|
||||||
),
|
),
|
||||||
io.Combo.Input("模型", options=NANO_BANANA_MODEL_OPTIONS, default="Nano Banana 2"),
|
io.Combo.Input("模型", options=NANO_BANANA_MODEL_OPTIONS, default="Nano Banana 2.1"),
|
||||||
io.Combo.Input(
|
io.Combo.Input(
|
||||||
"模型线路",
|
"模型线路",
|
||||||
options=NANO_BANANA_ROUTE_OPTIONS,
|
options=NANO_BANANA_ROUTE_OPTIONS,
|
||||||
@@ -1132,10 +1132,10 @@ class BatchNanoBananaPro(io.ComfyNode):
|
|||||||
was_interrupted = False
|
was_interrupted = False
|
||||||
skip_balance_query = False
|
skip_balance_query = False
|
||||||
|
|
||||||
# 只有 Nano Banana 2 支持思考等级;其他模型不向接口传该字段。
|
# Nano Banana 2 / 2.1 支持思考等级;其他模型不向接口传该字段。
|
||||||
if 思考等级 not in THINKING_LEVEL_MAP:
|
if 思考等级 not in THINKING_LEVEL_MAP:
|
||||||
raise ValueError(f"不支持的思考等级: {思考等级}")
|
raise ValueError(f"不支持的思考等级: {思考等级}")
|
||||||
thinking_level = THINKING_LEVEL_MAP[思考等级] if 模型 == "Nano Banana 2" else None
|
thinking_level = THINKING_LEVEL_MAP[思考等级] if 模型 in {"Nano Banana 2.1", "Nano Banana 2"} else None
|
||||||
|
|
||||||
# 验证模型配置是否合法(使用与 NanoBanana 相同的验证逻辑)
|
# 验证模型配置是否合法(使用与 NanoBanana 相同的验证逻辑)
|
||||||
self._validate_model_config(模型, 宽高比, 分辨率)
|
self._validate_model_config(模型, 宽高比, 分辨率)
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ class NanoBanana(io.ComfyNode):
|
|||||||
# Nano Banana 2 系列特有的宽高比
|
# Nano Banana 2 系列特有的宽高比
|
||||||
nano_2_exclusive_ratios = {"1:4", "1:8", "4:1", "8:1"}
|
nano_2_exclusive_ratios = {"1:4", "1:8", "4:1", "8:1"}
|
||||||
# 其他模型使用了 Nano Banana 2 系列专属宽高比
|
# 其他模型使用了 Nano Banana 2 系列专属宽高比
|
||||||
if model_name not in {"Nano Banana 2", "Nano Banana 2 Lite"} and aspect_ratio in nano_2_exclusive_ratios:
|
if model_name not in {"Nano Banana 2.1", "Nano Banana 2", "Nano Banana 2 Lite"} and aspect_ratio in nano_2_exclusive_ratios:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"宽高比 {aspect_ratio} 仅支持 Nano Banana 2 系列模型,"
|
f"宽高比 {aspect_ratio} 仅支持 Nano Banana 2 系列模型,"
|
||||||
f"当前模型 {model_name} 不支持此宽高比"
|
f"当前模型 {model_name} 不支持此宽高比"
|
||||||
@@ -458,7 +458,7 @@ class NanoBanana(io.ComfyNode):
|
|||||||
default="",
|
default="",
|
||||||
multiline=True,
|
multiline=True,
|
||||||
),
|
),
|
||||||
io.Combo.Input("模型", options=NANO_BANANA_MODEL_OPTIONS, default="Nano Banana 2"),
|
io.Combo.Input("模型", options=NANO_BANANA_MODEL_OPTIONS, default="Nano Banana 2.1"),
|
||||||
io.Combo.Input(
|
io.Combo.Input(
|
||||||
"模型线路",
|
"模型线路",
|
||||||
options=NANO_BANANA_ROUTE_OPTIONS,
|
options=NANO_BANANA_ROUTE_OPTIONS,
|
||||||
@@ -468,7 +468,7 @@ class NanoBanana(io.ComfyNode):
|
|||||||
"思考等级",
|
"思考等级",
|
||||||
options=["低", "高"],
|
options=["低", "高"],
|
||||||
default="高",
|
default="高",
|
||||||
tooltip="仅 Nano Banana 2 生效:低=minimal,高=high。",
|
tooltip="仅 Nano Banana 2 / 2.1 生效:低=minimal,高=high。",
|
||||||
),
|
),
|
||||||
io.Combo.Input("分辨率", options=["1K", "2K", "4K"], default="2K"),
|
io.Combo.Input("分辨率", options=["1K", "2K", "4K"], default="2K"),
|
||||||
io.Combo.Input("宽高比", options=[
|
io.Combo.Input("宽高比", options=[
|
||||||
@@ -527,7 +527,7 @@ class NanoBanana(io.ComfyNode):
|
|||||||
模型线路 = kwargs.pop("计费", 模型线路)
|
模型线路 = kwargs.pop("计费", 模型线路)
|
||||||
unlimited_downloads = kwargs.pop("_o1key_unlimited_downloads", False) is True
|
unlimited_downloads = kwargs.pop("_o1key_unlimited_downloads", False) is True
|
||||||
requested_google_search = kwargs.pop("_o1key_google_search", False) is True
|
requested_google_search = kwargs.pop("_o1key_google_search", False) is True
|
||||||
google_search = model_name == "Nano Banana 2" and requested_google_search
|
google_search = model_name in {"Nano Banana 2.1", "Nano Banana 2"} and requested_google_search
|
||||||
resize_mode = str(缩放图片)
|
resize_mode = str(缩放图片)
|
||||||
if resize_mode not in {"不缩放", "智能缩放"}:
|
if resize_mode not in {"不缩放", "智能缩放"}:
|
||||||
raise ValueError("缩放图片参数无效")
|
raise ValueError("缩放图片参数无效")
|
||||||
@@ -538,7 +538,7 @@ class NanoBanana(io.ComfyNode):
|
|||||||
raise ValueError("思考等级无效,仅支持:低、高")
|
raise ValueError("思考等级无效,仅支持:低、高")
|
||||||
thinking_level = (
|
thinking_level = (
|
||||||
THINKING_LEVEL_MAP[思考等级]
|
THINKING_LEVEL_MAP[思考等级]
|
||||||
if model_name == "Nano Banana 2"
|
if model_name in {"Nano Banana 2.1", "Nano Banana 2"}
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ class O1keyImageGenerator(io.ComfyNode):
|
|||||||
io.Combo.Input(
|
io.Combo.Input(
|
||||||
"模型",
|
"模型",
|
||||||
options=UNIFIED_IMAGE_MODEL_OPTIONS,
|
options=UNIFIED_IMAGE_MODEL_OPTIONS,
|
||||||
default="Nano Banana 2",
|
default="Nano Banana 2.1",
|
||||||
socketless=True,
|
socketless=True,
|
||||||
),
|
),
|
||||||
io.Combo.Input(
|
io.Combo.Input(
|
||||||
@@ -663,7 +663,7 @@ class O1keyImageGenerator(io.ComfyNode):
|
|||||||
"在线搜索",
|
"在线搜索",
|
||||||
options=["关闭", "打开"],
|
options=["关闭", "打开"],
|
||||||
default="关闭",
|
default="关闭",
|
||||||
tooltip="仅 Nano Banana 2 生效;打开时发送 google_search=true。",
|
tooltip="仅 Nano Banana 2 / 2.1 生效;打开时发送 google_search=true。",
|
||||||
socketless=True,
|
socketless=True,
|
||||||
),
|
),
|
||||||
io.Boolean.Input(
|
io.Boolean.Input(
|
||||||
@@ -688,7 +688,7 @@ class O1keyImageGenerator(io.ComfyNode):
|
|||||||
async def execute(
|
async def execute(
|
||||||
cls,
|
cls,
|
||||||
prompt: str,
|
prompt: str,
|
||||||
模型: str = "Nano Banana 2",
|
模型: str = "Nano Banana 2.1",
|
||||||
模型线路: str = "畅速",
|
模型线路: str = "畅速",
|
||||||
思考等级: str = "低",
|
思考等级: str = "低",
|
||||||
分辨率: str = UNIFIED_IMAGE_SMART_RESOLUTION,
|
分辨率: str = UNIFIED_IMAGE_SMART_RESOLUTION,
|
||||||
@@ -731,7 +731,7 @@ class O1keyImageGenerator(io.ComfyNode):
|
|||||||
raise ValueError("缩放图片参数无效")
|
raise ValueError("缩放图片参数无效")
|
||||||
if 在线搜索 not in {"关闭", "打开"}:
|
if 在线搜索 not in {"关闭", "打开"}:
|
||||||
raise ValueError("在线搜索参数无效")
|
raise ValueError("在线搜索参数无效")
|
||||||
google_search = 模型 == "Nano Banana 2" and 在线搜索 == "打开"
|
google_search = 模型 in {"Nano Banana 2.1", "Nano Banana 2"} and 在线搜索 == "打开"
|
||||||
|
|
||||||
image_count = int(生图数量)
|
image_count = int(生图数量)
|
||||||
if is_gpt_image_model(模型):
|
if is_gpt_image_model(模型):
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import AsyncMock, patch
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
@@ -54,6 +55,7 @@ class NanoBananaDynamicInputTests(unittest.TestCase):
|
|||||||
self.assertNotIn("网络", inputs)
|
self.assertNotIn("网络", inputs)
|
||||||
self.assertFalse(inputs["模型线路"].advanced)
|
self.assertFalse(inputs["模型线路"].advanced)
|
||||||
self.assertEqual(inputs["模型"].options, NANO_BANANA_MODEL_OPTIONS)
|
self.assertEqual(inputs["模型"].options, NANO_BANANA_MODEL_OPTIONS)
|
||||||
|
self.assertEqual(inputs["模型"].default, "Nano Banana 2.1")
|
||||||
self.assertEqual(inputs["模型线路"].options, NANO_BANANA_ROUTE_OPTIONS)
|
self.assertEqual(inputs["模型线路"].options, NANO_BANANA_ROUTE_OPTIONS)
|
||||||
self.assertEqual(inputs["分辨率"].options, ["1K", "2K", "4K"])
|
self.assertEqual(inputs["分辨率"].options, ["1K", "2K", "4K"])
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@@ -96,6 +98,9 @@ class NanoBananaDynamicInputTests(unittest.TestCase):
|
|||||||
|
|
||||||
def test_model_route_matrix_matches_api_model_names(self):
|
def test_model_route_matrix_matches_api_model_names(self):
|
||||||
expected = {
|
expected = {
|
||||||
|
("Nano Banana 2.1", "畅速"): "gemini-nano-banana-2.1-sp",
|
||||||
|
("Nano Banana 2.1", "直连"): "gemini-nano-banana-2.1-sd",
|
||||||
|
("Nano Banana 2.1", "专线"): "gemini-nano-banana-2.1",
|
||||||
("Nano Banana Pro", "畅速"): "gemini-3-pro-image-c-sp",
|
("Nano Banana Pro", "畅速"): "gemini-3-pro-image-c-sp",
|
||||||
("Nano Banana 2", "畅速"): "gemini-3.1-flash-image-c-sp",
|
("Nano Banana 2", "畅速"): "gemini-3.1-flash-image-c-sp",
|
||||||
("Nano Banana 2 Lite", "畅速"): "gemini-3.1-flash-lite-image-c-sp",
|
("Nano Banana 2 Lite", "畅速"): "gemini-3.1-flash-lite-image-c-sp",
|
||||||
@@ -113,6 +118,40 @@ class NanoBananaDynamicInputTests(unittest.TestCase):
|
|||||||
for key, model_id in expected.items():
|
for key, model_id in expected.items():
|
||||||
self.assertEqual(resolve_nano_banana_model(*key), model_id)
|
self.assertEqual(resolve_nano_banana_model(*key), model_id)
|
||||||
|
|
||||||
|
def test_nano_banana_21_supports_extended_ratios_and_existing_resolutions(self):
|
||||||
|
for node in (NanoBanana, BatchNanoBananaPro):
|
||||||
|
for resolution in ("1K", "2K", "4K"):
|
||||||
|
for ratio in ("1:4", "1:8", "4:1", "8:1"):
|
||||||
|
with self.subTest(node=node.__name__, resolution=resolution, ratio=ratio):
|
||||||
|
node._validate_model_config("Nano Banana 2.1", ratio, resolution)
|
||||||
|
|
||||||
|
def test_nano_banana_21_forwards_route_thinking_and_search(self):
|
||||||
|
image = Image.new("RGB", (4, 4), "purple")
|
||||||
|
for route, model_id in (
|
||||||
|
("畅速", "gemini-nano-banana-2.1-sp"),
|
||||||
|
("直连", "gemini-nano-banana-2.1-sd"),
|
||||||
|
("专线", "gemini-nano-banana-2.1"),
|
||||||
|
):
|
||||||
|
with self.subTest(route=route), patch(
|
||||||
|
"comfyui_o1key.nodes.nano_banana._process_batch_async",
|
||||||
|
new=AsyncMock(return_value=[{"success": True, "output_images": [image]}]),
|
||||||
|
) as generate, patch(
|
||||||
|
"comfyui_o1key.nodes.nano_banana.get_api_key_or_raise", return_value="test",
|
||||||
|
), patch(
|
||||||
|
"comfyui_o1key.nodes.nano_banana.get_base_url_by_route",
|
||||||
|
return_value="https://example.invalid",
|
||||||
|
), patch(
|
||||||
|
"comfyui_o1key.nodes.nano_banana._get_client", side_effect=RuntimeError("offline"),
|
||||||
|
):
|
||||||
|
NanoBanana.execute(
|
||||||
|
prompt="test", 模型="Nano Banana 2.1", 模型线路=route,
|
||||||
|
分辨率="2K", 宽高比="1:8", 生图数量="2", 思考等级="低",
|
||||||
|
_o1key_google_search=True,
|
||||||
|
)
|
||||||
|
self.assertEqual(generate.call_args.kwargs["model"], model_id)
|
||||||
|
self.assertEqual(generate.call_args.kwargs["thinking_level"], "minimal")
|
||||||
|
self.assertIs(generate.call_args.kwargs["google_search"], True)
|
||||||
|
|
||||||
def test_legacy_billing_values_resolve_to_equivalent_routes(self):
|
def test_legacy_billing_values_resolve_to_equivalent_routes(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
resolve_nano_banana_model("Nano Banana Pro", "特价"),
|
resolve_nano_banana_model("Nano Banana Pro", "特价"),
|
||||||
@@ -136,6 +175,8 @@ class BatchNanoBananaDynamicInputTests(unittest.TestCase):
|
|||||||
inputs = {item.id: item for item in schema.inputs}
|
inputs = {item.id: item for item in schema.inputs}
|
||||||
|
|
||||||
self.assertEqual(schema.display_name, "Nano Banana 批量跑图")
|
self.assertEqual(schema.display_name, "Nano Banana 批量跑图")
|
||||||
|
self.assertEqual(inputs["模型"].options, NANO_BANANA_MODEL_OPTIONS)
|
||||||
|
self.assertEqual(inputs["模型"].default, "Nano Banana 2.1")
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[item.id for item in schema.inputs[:7]],
|
[item.id for item in schema.inputs[:7]],
|
||||||
["prompt", "模型", "模型线路", "思考等级", "分辨率", "宽高比", "图片路径数量"],
|
["prompt", "模型", "模型线路", "思考等级", "分辨率", "宽高比", "图片路径数量"],
|
||||||
@@ -199,6 +240,35 @@ class BatchNanoBananaDynamicInputTests(unittest.TestCase):
|
|||||||
with self.assertRaisesRegex(ValueError, "分辨率 '512' 无效"):
|
with self.assertRaisesRegex(ValueError, "分辨率 '512' 无效"):
|
||||||
BatchNanoBananaPro._validate_model_config("Nano Banana 2", "1:1", "512")
|
BatchNanoBananaPro._validate_model_config("Nano Banana 2", "1:1", "512")
|
||||||
|
|
||||||
|
def test_nano_banana_21_batch_forwards_model_and_thinking_level(self):
|
||||||
|
image = ImageInfo(Image.new("RGB", (4, 4), "purple"), "reference", ".png", "")
|
||||||
|
for route, model_id in (
|
||||||
|
("畅速", "gemini-nano-banana-2.1-sp"),
|
||||||
|
("直连", "gemini-nano-banana-2.1-sd"),
|
||||||
|
("专线", "gemini-nano-banana-2.1"),
|
||||||
|
):
|
||||||
|
with self.subTest(route=route), tempfile.TemporaryDirectory() as output_dir, patch.object(
|
||||||
|
BatchNanoBananaPro, "_process_batch_async",
|
||||||
|
new=AsyncMock(return_value=[{"success": True, "generated_count": 1}]),
|
||||||
|
) as generate, patch(
|
||||||
|
"comfyui_o1key.nodes.batch_nano_banana.load_images_from_folder", return_value=[image],
|
||||||
|
), patch(
|
||||||
|
"comfyui_o1key.nodes.batch_nano_banana.get_api_key_or_raise", return_value="test",
|
||||||
|
), patch(
|
||||||
|
"comfyui_o1key.nodes.batch_nano_banana.get_base_url_by_route",
|
||||||
|
return_value="https://example.invalid",
|
||||||
|
), patch(
|
||||||
|
"comfyui_o1key.nodes.batch_nano_banana.GeminiAPIClient",
|
||||||
|
side_effect=RuntimeError("offline"),
|
||||||
|
):
|
||||||
|
BatchNanoBananaPro.execute(
|
||||||
|
prompt="test", 模型="Nano Banana 2.1", 模型线路=route,
|
||||||
|
思考等级="高", 分辨率="4K", 宽高比="8:1",
|
||||||
|
图片路径1="mock-input", 图片保存路径=output_dir,
|
||||||
|
)
|
||||||
|
self.assertEqual(generate.call_args.kwargs["model"], model_id)
|
||||||
|
self.assertEqual(generate.call_args.kwargs["thinking_level"], "high")
|
||||||
|
|
||||||
def test_execute_unpacks_dynamic_folders_and_autogrow_references(self):
|
def test_execute_unpacks_dynamic_folders_and_autogrow_references(self):
|
||||||
first_reference = object()
|
first_reference = object()
|
||||||
third_reference = object()
|
third_reference = object()
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class O1keyImageGeneratorTests(unittest.TestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list(UNIFIED_IMAGE_MODEL_OPTIONS),
|
list(UNIFIED_IMAGE_MODEL_OPTIONS),
|
||||||
[
|
[
|
||||||
|
"Nano Banana 2.1",
|
||||||
"Nano Banana 2",
|
"Nano Banana 2",
|
||||||
"Nano Banana Pro",
|
"Nano Banana Pro",
|
||||||
"gpt-image-2",
|
"gpt-image-2",
|
||||||
@@ -97,6 +98,7 @@ class O1keyImageGeneratorTests(unittest.TestCase):
|
|||||||
self.assertEqual(count_input.options, [str(value) for value in range(1, 10)])
|
self.assertEqual(count_input.options, [str(value) for value in range(1, 10)])
|
||||||
self.assertEqual(count_input.default, "1")
|
self.assertEqual(count_input.default, "1")
|
||||||
model_input = next(item for item in schema.inputs if item.id == "模型")
|
model_input = next(item for item in schema.inputs if item.id == "模型")
|
||||||
|
self.assertEqual(model_input.default, "Nano Banana 2.1")
|
||||||
self.assertIn("gpt-image-2", model_input.options)
|
self.assertIn("gpt-image-2", model_input.options)
|
||||||
self.assertIn("gpt-image-2.5-sunburst", model_input.options)
|
self.assertIn("gpt-image-2.5-sunburst", model_input.options)
|
||||||
self.assertIn("gpt-image-2.5-flare", model_input.options)
|
self.assertIn("gpt-image-2.5-flare", model_input.options)
|
||||||
@@ -366,6 +368,22 @@ class O1keyImageGeneratorTests(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertIs(execute.call_args.kwargs["_o1key_google_search"], False)
|
self.assertIs(execute.call_args.kwargs["_o1key_google_search"], False)
|
||||||
|
|
||||||
|
def test_default_model_delegates_nano_banana_21_with_search_and_thinking(self):
|
||||||
|
image = torch.zeros((1, 8, 8, 3), dtype=torch.float32)
|
||||||
|
with patch(
|
||||||
|
"comfyui_o1key.nodes.o1key_image_generator.NanoBanana.execute",
|
||||||
|
return_value=io.NodeOutput(image),
|
||||||
|
) as execute:
|
||||||
|
result = asyncio.run(O1keyImageGenerator.execute(
|
||||||
|
prompt="test", 模型线路="直连", 思考等级="高",
|
||||||
|
分辨率="4K", 宽高比="1:8", 在线搜索="打开",
|
||||||
|
))
|
||||||
|
self.assertIs(result[0], image)
|
||||||
|
self.assertEqual(execute.call_args.kwargs["模型"], "Nano Banana 2.1")
|
||||||
|
self.assertEqual(execute.call_args.kwargs["模型线路"], "直连")
|
||||||
|
self.assertEqual(execute.call_args.kwargs["思考等级"], "高")
|
||||||
|
self.assertIs(execute.call_args.kwargs["_o1key_google_search"], True)
|
||||||
|
|
||||||
def test_error_wrappers_apply_to_every_model_family(self):
|
def test_error_wrappers_apply_to_every_model_family(self):
|
||||||
raw = (
|
raw = (
|
||||||
"status_code=451, The provided prompt is considered unsafe and it "
|
"status_code=451, The provided prompt is considered unsafe and it "
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ class Element {
|
|||||||
append(...items) { this.children.push(...items); }
|
append(...items) { this.children.push(...items); }
|
||||||
prepend(...items) { this.children.unshift(...items); }
|
prepend(...items) { this.children.unshift(...items); }
|
||||||
replaceChildren(...items) { this.children = [...items]; }
|
replaceChildren(...items) { this.children = [...items]; }
|
||||||
|
contains(element) { return this === element || this.children.some(child => child.contains?.(element)); }
|
||||||
addEventListener(type, listener) { this.listeners.set(type, listener); }
|
addEventListener(type, listener) { this.listeners.set(type, listener); }
|
||||||
setAttribute(name, value) { this[name] = value; }
|
setAttribute(name, value) { this[name] = value; }
|
||||||
dispatch(type, event = { stopPropagation() {} }) { return this.listeners.get(type)?.(event); }
|
dispatch(type, event = { stopPropagation() {} }) { return this.listeners.get(type)?.(event); }
|
||||||
@@ -231,6 +232,9 @@ vm.runInContext(source, context, { filename: sourcePath.pathname });
|
|||||||
}
|
}
|
||||||
|
|
||||||
const setStatus = vm.runInContext("setStatus", context);
|
const setStatus = vm.runInContext("setStatus", context);
|
||||||
|
const buildPanel = vm.runInContext("buildPanel", context);
|
||||||
|
const restorePanelFromWidgets = vm.runInContext("restorePanelFromWidgets", context);
|
||||||
|
const serializeGeneratorWidgets = vm.runInContext("serializeGeneratorWidgets", context);
|
||||||
const makeDropdown = vm.runInContext("makeDropdown", context);
|
const makeDropdown = vm.runInContext("makeDropdown", context);
|
||||||
const isGeneratedSeedControl = vm.runInContext("isGeneratedSeedControl", context);
|
const isGeneratedSeedControl = vm.runInContext("isGeneratedSeedControl", context);
|
||||||
const hideBackendWidgets = vm.runInContext("hideBackendWidgets", context);
|
const hideBackendWidgets = vm.runInContext("hideBackendWidgets", context);
|
||||||
@@ -372,6 +376,72 @@ function createRecoveryNodes(batchId, generatorId, saveNodeId) {
|
|||||||
assert.equal(unrelatedControl.hidden, undefined);
|
assert.equal(unrelatedControl.hidden, undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const names = [
|
||||||
|
"prompt", "模型", "模型线路", "思考等级", "分辨率", "宽高比", "生图数量", "seed",
|
||||||
|
"参考图清单", "质量", "输出格式", "蒙版清单", "缩放图片", "背景", "批量出图",
|
||||||
|
"批量模式", "模特图清单", "命名规则", "filename_prefix", "格式", "保存位置", "在线搜索", "图层拆分",
|
||||||
|
];
|
||||||
|
const values = [
|
||||||
|
"saved panel prompt", "Nano Banana 2.1", "专线", "高", "2K", "1:8", "4", 123,
|
||||||
|
"[]", "自动", "jpeg", "{}", "不缩放", "auto", false,
|
||||||
|
"一组搭配+多模特", "[]", "自定义前缀", "kept-prefix", "原始", "kept-location", "打开", false,
|
||||||
|
];
|
||||||
|
const widgets = names.map((name, index) => ({ name, value: values[index], options: {} }));
|
||||||
|
const node = {
|
||||||
|
comfyClass: "O1keyImageGenerator", widgets, size: [560, 1035], outputs: [],
|
||||||
|
addDOMWidget(name, type, element, options) {
|
||||||
|
const widget = { name, type, element, options };this.widgets.push(widget);return widget;
|
||||||
|
},
|
||||||
|
computeSize() { return [500, 1025]; },
|
||||||
|
setSize(size) { this.size = size; },
|
||||||
|
setDirtyCanvas() {},
|
||||||
|
};
|
||||||
|
buildPanel(node);
|
||||||
|
const panel = node._o1igPanel;
|
||||||
|
const count = node.widgets.length;
|
||||||
|
buildPanel(node);
|
||||||
|
assert.equal(node._o1igPanel, panel);
|
||||||
|
assert.equal(node.widgets.length, count);
|
||||||
|
assert.equal(panel.className, "o1ig-panel");
|
||||||
|
assert.equal(node.widgets.length, names.length + 1, "Keep one panel rather than appending native action rows");
|
||||||
|
assert.deepEqual(node.widgets.slice(0, names.length).map(widget => widget.name), names);
|
||||||
|
assert.equal(node._o1igPrompt.tagName, "TEXTAREA");
|
||||||
|
assert.equal(node._o1igGenerate.tagName, "BUTTON");
|
||||||
|
assert.equal(node._o1igGenerate.className, "o1ig-generate");
|
||||||
|
assert.equal(panel.children.at(-1), node._o1igGenerate, "Start generation stays at the bottom of the panel");
|
||||||
|
const promptWrap = panel.children.find(child => child.className === "o1ig-prompt-wrap");
|
||||||
|
assert.ok(promptWrap.children.includes(node._o1igPromptOptimize), "AI writing remains inside the prompt area");
|
||||||
|
const seedField = node._o1igToolbar.children.find(child => child.children[1]?.className === "o1ig-seed");
|
||||||
|
assert.equal(seedField.children[1].children[0], node._o1igSeed);
|
||||||
|
assert.equal(seedField.children[1].children[1].title, "随机种子");
|
||||||
|
assert.ok(node._o1igReferenceHeader.contains(node._o1igAdd));
|
||||||
|
assert.ok(node._o1igReferenceHeader.contains(node._o1igCanvasPick));
|
||||||
|
assert.equal(node._o1igRefs.children[0].className, "o1ig-empty-reference");
|
||||||
|
node._o1igBatchToggle.dispatch("click");
|
||||||
|
assert.equal(node._o1igBatchEnabled, true);
|
||||||
|
assert.equal(node._o1igModelAssets.classList.contains("visible"), true);
|
||||||
|
node._o1igBatchToggle.dispatch("click");
|
||||||
|
assert.equal(node._o1igBatchEnabled, false);
|
||||||
|
const computeSize = widgets[0].computeSize;
|
||||||
|
widgets[0].options = {};widgets[0].hidden = false;
|
||||||
|
restorePanelFromWidgets(node);
|
||||||
|
assert.equal(widgets[0].options.hidden, true, "Keep backend fields hidden after a renderer switch");
|
||||||
|
assert.equal(widgets[0].computeSize, computeSize);
|
||||||
|
assert.equal(node._o1igModel.value, "Nano Banana 2.1");
|
||||||
|
assert.equal(node._o1igSeed.value, "123");
|
||||||
|
assert.equal(node._o1igFilenamePrefix.value, "kept-prefix");
|
||||||
|
assert.equal(node._o1igSaveLocation.value, "kept-location");
|
||||||
|
const saved = {};serializeGeneratorWidgets(node, saved);
|
||||||
|
assert.equal(saved.widgets_values.length, names.length);
|
||||||
|
assert.equal(saved.widgets_values[7], 123);
|
||||||
|
assert.equal(saved.widgets_values[18], "kept-prefix");
|
||||||
|
assert.equal(saved.widgets_values[20], "kept-location");
|
||||||
|
const panelCss = source.slice(source.indexOf("const CSS"), source.indexOf(".o1igs-progress-host"));
|
||||||
|
assert.doesNotMatch(panelCss, /#[0-9a-f]{3,8}\b|rgba?\(/i, "Use ComfyUI theme colours for every panel control and button");
|
||||||
|
assert.doesNotMatch(source, /function nativeAction|function bindNativeWidget|_o1igNativeWidgetsReady/);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const linkId = 8800;
|
const linkId = 8800;
|
||||||
const generator = {
|
const generator = {
|
||||||
@@ -961,6 +1031,7 @@ function createRecoveryNodes(batchId, generatorId, saveNodeId) {
|
|||||||
styled: button.classList.contains("has-description"),
|
styled: button.classList.contains("has-description"),
|
||||||
}));
|
}));
|
||||||
assert.deepEqual(JSON.parse(JSON.stringify(descriptions)), [
|
assert.deepEqual(JSON.parse(JSON.stringify(descriptions)), [
|
||||||
|
{ model: "Nano Banana 2.1", description: "快速,批量", styled: true },
|
||||||
{ model: "Nano Banana 2", description: "快速,批量", styled: true },
|
{ model: "Nano Banana 2", description: "快速,批量", styled: true },
|
||||||
{ model: "Nano Banana Pro", description: "高质量资产", styled: true },
|
{ model: "Nano Banana Pro", description: "高质量资产", styled: true },
|
||||||
{ model: "GPT Image 2", description: "高质量,编辑", styled: true },
|
{ model: "GPT Image 2", description: "高质量,编辑", styled: true },
|
||||||
@@ -1119,6 +1190,18 @@ function createRecoveryNodes(batchId, generatorId, saveNodeId) {
|
|||||||
assert.equal(node._o1igSaveFormatField.style.display, "");
|
assert.equal(node._o1igSaveFormatField.style.display, "");
|
||||||
assert.equal(node._o1igResizeWarning.classList.contains("visible"), true);
|
assert.equal(node._o1igResizeWarning.classList.contains("visible"), true);
|
||||||
|
|
||||||
|
node._o1igModel.value = "Nano Banana 2.1";
|
||||||
|
syncModelOptions(node);
|
||||||
|
assert.deepEqual(
|
||||||
|
JSON.parse(JSON.stringify(node._o1igResolution._o1igOptions.map(option => option.value))),
|
||||||
|
["智能", "1K", "2K", "4K"],
|
||||||
|
);
|
||||||
|
assert.equal(node._o1igRatio._o1igOptions.some(option => option.value === "1:8"), true);
|
||||||
|
assert.equal(node._o1igThinkingField.style.display, "");
|
||||||
|
assert.equal(node._o1igOnlineSearchField.style.display, "");
|
||||||
|
assert.equal(node._o1igSaveFormatField.style.display, "");
|
||||||
|
assert.equal(widgets.find((widget) => widget.name === "模型").value, "Nano Banana 2.1");
|
||||||
|
|
||||||
node._o1igModel.value = "Nano Banana 2 Lite";
|
node._o1igModel.value = "Nano Banana 2 Lite";
|
||||||
syncModelOptions(node);
|
syncModelOptions(node);
|
||||||
assert.equal(node._o1igResolution._o1igOptions.some((option) => option.value === "512"), true);
|
assert.equal(node._o1igResolution._o1igOptions.some((option) => option.value === "512"), true);
|
||||||
@@ -2702,7 +2785,7 @@ assert.doesNotMatch(savePanelSource, /addDOMWidget/);
|
|||||||
assert.doesNotMatch(savePanelSource, /prefixWidget\.hidden = true/);
|
assert.doesNotMatch(savePanelSource, /prefixWidget\.hidden = true/);
|
||||||
assert.doesNotMatch(source, /installNativeMinimumSize\(nodeType, SAVE_NODE_LAYOUT_SIZE\)/);
|
assert.doesNotMatch(source, /installNativeMinimumSize\(nodeType, SAVE_NODE_LAYOUT_SIZE\)/);
|
||||||
assert.match(source, /lucide--download.*lucide--refresh-cw/);
|
assert.match(source, /lucide--download.*lucide--refresh-cw/);
|
||||||
assert.match(source, /font-size:12px;font-weight:500;line-height:1\.4;letter-spacing:\.035em/);
|
assert.match(source, /--o1ig-surface:var\(--component-node-widget-background,var\(--comfy-input-bg\)\)/);
|
||||||
assert.match(source, /o1ig-select-caret svg\{display:block;width:12px;height:12px/);
|
assert.match(source, /o1ig-select-caret svg\{display:block;width:12px;height:12px/);
|
||||||
assert.match(source, /const GENERATOR_DEFAULT_SIZE = \[560, 1035\]/);
|
assert.match(source, /const GENERATOR_DEFAULT_SIZE = \[560, 1035\]/);
|
||||||
assert.doesNotMatch(source, /o1key-save-custom-prefix/);
|
assert.doesNotMatch(source, /o1key-save-custom-prefix/);
|
||||||
@@ -2717,7 +2800,7 @@ assert.match(source, /delete nodeData\.input\.optional\.external_prompt/);
|
|||||||
assert.doesNotMatch(source, /app\.queuePrompt\(0, 1, \[saveNode\.id\]\)/);
|
assert.doesNotMatch(source, /app\.queuePrompt\(0, 1, \[saveNode\.id\]\)/);
|
||||||
assert.match(source, /\.o1ig-refs\{[\s\S]*?flex:0 0 109px[\s\S]*?min-height:109px/);
|
assert.match(source, /\.o1ig-refs\{[\s\S]*?flex:0 0 109px[\s\S]*?min-height:109px/);
|
||||||
assert.match(source, /\.o1ig-thumb\{[\s\S]*?flex:0 0 102px;height:102px/);
|
assert.match(source, /\.o1ig-thumb\{[\s\S]*?flex:0 0 102px;height:102px/);
|
||||||
assert.match(source, /\.o1ig-thumb img\{[\s\S]*?object-fit:contain;background:#111/);
|
assert.match(source, /\.o1ig-thumb img\{[\s\S]*?object-fit:contain;background:var\(--o1ig-surface\)/);
|
||||||
assert.match(source, /referenceActions\.append\(add, canvasPick\)/);
|
assert.match(source, /referenceActions\.append\(add, canvasPick\)/);
|
||||||
assert.match(source, /modelActions\.append\(modelAdd, modelCanvasPick\)/);
|
assert.match(source, /modelActions\.append\(modelAdd, modelCanvasPick\)/);
|
||||||
assert.match(source, /window\.o1keyCanvasImagePicker = Object\.freeze/);
|
assert.match(source, /window\.o1keyCanvasImagePicker = Object\.freeze/);
|
||||||
@@ -2732,16 +2815,16 @@ assert.match(source, /\.o1ig-thumb\.o1ig-dragging::before\{[\s\S]*?content:"移
|
|||||||
assert.match(source, /\.o1ig-refs\.o1ig-reordering\{/);
|
assert.match(source, /\.o1ig-refs\.o1ig-reordering\{/);
|
||||||
assert.match(source, /\.o1ig-thumb\.o1ig-drop-before\{transform:translateX\(7px\)/);
|
assert.match(source, /\.o1ig-thumb\.o1ig-drop-before\{transform:translateX\(7px\)/);
|
||||||
assert.match(source, /\.o1ig-empty-reference:hover,\.o1ig-empty-reference\.drag\{/);
|
assert.match(source, /\.o1ig-empty-reference:hover,\.o1ig-empty-reference\.drag\{/);
|
||||||
assert.match(source, /\.o1ig-toolbar\{[^\n]*grid-template-columns:repeat\(2,minmax\(0,1fr\)\)/);
|
assert.match(source, /\.o1ig-toolbar\{[^\n]*grid-template-columns:minmax\(0,1fr\)/);
|
||||||
assert.match(source, /\.o1ig-field\{display:flex;flex-direction:column/);
|
assert.match(source, /\.o1ig-field\{display:grid;grid-template-columns:104px minmax\(0,1fr\)/);
|
||||||
assert.match(source, /makePanelSectionTitle\("画面描述"\)/);
|
assert.match(source, /makePanelSectionTitle\("画面描述"\)/);
|
||||||
assert.match(source, /makePanelSectionTitle\("生成参数"\)/);
|
assert.match(source, /makePanelSectionTitle\("生成参数"\)/);
|
||||||
assert.match(source, /makePanelSectionTitle\("保存设置"\)/);
|
assert.match(source, /makePanelSectionTitle\("保存设置"\)/);
|
||||||
assert.match(source, /filenamePrefixField\.classList\.add\("o1ig-field-wide"\)/);
|
assert.match(source, /filenamePrefixField\.classList\.add\("o1ig-field-wide"\)/);
|
||||||
assert.match(source, /saveLocationField\.classList\.add\("o1ig-field-wide"\)/);
|
assert.match(source, /saveLocationField\.classList\.add\("o1ig-field-wide"\)/);
|
||||||
assert.match(source, /o1ig-resize-warning\{display:none;color:#d5aa62/);
|
assert.match(source, /o1ig-resize-warning\{display:none;grid-column:2;color:var\(--o1ig-muted\)/);
|
||||||
assert.match(source, /o1ig-resize-warning\.visible\{display:block/);
|
assert.match(source, /o1ig-resize-warning\.visible\{display:block/);
|
||||||
assert.match(source, /o1ig-seed\{[\s\S]*grid-template-columns:minmax\(0,1fr\) 34px;gap:0/);
|
assert.match(source, /o1ig-seed\{[\s\S]*grid-template-columns:minmax\(0,1fr\) 28px;gap:0/);
|
||||||
assert.match(source, /o1ig-seed button\{[\s\S]*border-left:1px solid/);
|
assert.match(source, /o1ig-seed button\{[\s\S]*border-left:1px solid/);
|
||||||
assert.match(source, /className = "o1ig-prompt-optimize"/);
|
assert.match(source, /className = "o1ig-prompt-optimize"/);
|
||||||
assert.match(source, /className = "o1ig-prompt-optimize-status"/);
|
assert.match(source, /className = "o1ig-prompt-optimize-status"/);
|
||||||
@@ -2895,7 +2978,7 @@ assert.match(source, /jobPayload\.google_search = true/);
|
|||||||
assert.match(source, /jobPayload\.layer_decomposition = true/);
|
assert.match(source, /jobPayload\.layer_decomposition = true/);
|
||||||
assert.match(source, /if \(layerDecomposition\) \{\s*layerSaveNode = acquireLayerSaveNodeForBatch\(node, saveNode\);/);
|
assert.match(source, /if \(layerDecomposition\) \{\s*layerSaveNode = acquireLayerSaveNodeForBatch\(node, saveNode\);/);
|
||||||
assert.match(source, /layerDecomposition,\s*retrySlotIndex,/);
|
assert.match(source, /layerDecomposition,\s*retrySlotIndex,/);
|
||||||
assert.match(source, /node\._o1igModel\.value === "Nano Banana 2"/);
|
assert.match(source, /\["Nano Banana 2\.1", "Nano Banana 2"\]\.includes\(node\._o1igModel\.value\)/);
|
||||||
assert.match(source, /node\._o1igOnlineSearch\.value === "打开"/);
|
assert.match(source, /node\._o1igOnlineSearch\.value === "打开"/);
|
||||||
assert.match(source, /batch_enabled: retryTask \? false : Boolean\(node\._o1igBatchEnabled\)/);
|
assert.match(source, /batch_enabled: retryTask \? false : Boolean\(node\._o1igBatchEnabled\)/);
|
||||||
assert.match(source, /model_references: retryTask \|\| node\._o1igBatchMode\.value === BATCH_MODE_SINGLE_REFERENCES/);
|
assert.match(source, /model_references: retryTask \|\| node\._o1igBatchMode\.value === BATCH_MODE_SINGLE_REFERENCES/);
|
||||||
@@ -2969,6 +3052,27 @@ assert.match(migrationSource, /原生 seed 参数/);
|
|||||||
migrationContext,
|
migrationContext,
|
||||||
);
|
);
|
||||||
const legacyRedCastValues = [1.0, 8.0, 0.1, "", 62.0, 15.0];
|
const legacyRedCastValues = [1.0, 8.0, 0.1, "", 62.0, 15.0];
|
||||||
|
const nativeValues = [
|
||||||
|
"legacy native prompt", "Nano Banana 2.1", "专线", "高", "2K", "1:8", "4", 678803244,
|
||||||
|
"[]", "最高", "png", "{}", "智能缩放", "transparent", false,
|
||||||
|
"一组搭配+多模特", "[]", "自定义前缀", "legacy-prefix", "原始", "relative-save", "打开", false,
|
||||||
|
];
|
||||||
|
const oldPanelValues = [...nativeValues];
|
||||||
|
oldPanelValues.splice(8, 0, "randomize");
|
||||||
|
oldPanelValues.push("");
|
||||||
|
const nativeGraph = {
|
||||||
|
nodes: [{ type: "O1keyImageGenerator", widgets_values: oldPanelValues }],
|
||||||
|
definitions: { subgraphs: [{
|
||||||
|
nodes: [{ type: "O1keyImageGenerator", widgets_values: [...oldPanelValues] }],
|
||||||
|
}] },
|
||||||
|
};
|
||||||
|
migrationExtension.beforeConfigureGraph(nativeGraph);
|
||||||
|
assert.deepEqual(nativeGraph.nodes[0].widgets_values, nativeValues);
|
||||||
|
assert.deepEqual(nativeGraph.definitions.subgraphs[0].nodes[0].widgets_values, nativeValues);
|
||||||
|
migrationExtension.beforeConfigureGraph(nativeGraph);
|
||||||
|
assert.deepEqual(nativeGraph.nodes[0].widgets_values, nativeValues);
|
||||||
|
assert.deepEqual(nativeGraph.definitions.subgraphs[0].nodes[0].widgets_values, nativeValues);
|
||||||
|
|
||||||
const legacyRedCastGraph = {
|
const legacyRedCastGraph = {
|
||||||
nodes: [{ type: "O1keyAutoRedCast", widgets_values: legacyRedCastValues }],
|
nodes: [{ type: "O1keyAutoRedCast", widgets_values: legacyRedCastValues }],
|
||||||
};
|
};
|
||||||
@@ -3182,6 +3286,22 @@ assert.match(migrationSource, /原生 seed 参数/);
|
|||||||
"不缩放", "原始", 95, "和原始图片名保持一致", "", 0,
|
"不缩放", "原始", 95, "和原始图片名保持一致", "", 0,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
for (const [type, original] of [
|
||||||
|
["NanoBanana", legacyNanoValues],
|
||||||
|
["BatchNanoBananaPro", legacyBatchNanoValues],
|
||||||
|
["O1keyImageGenerator", movedGeneratorValues],
|
||||||
|
]) {
|
||||||
|
for (const model of ["Nano Banana 2.1", "Nano Banana 2"]) {
|
||||||
|
const values = [...original];
|
||||||
|
values[1] = model;
|
||||||
|
const expected = [...values];
|
||||||
|
const graph = { nodes: [{ type, widgets_values: values }] };
|
||||||
|
migrationExtension.beforeConfigureGraph(graph);
|
||||||
|
migrationExtension.beforeConfigureGraph(graph);
|
||||||
|
assert.deepEqual(values, expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const stringQualityValues = [
|
const stringQualityValues = [
|
||||||
"prompt", "Nano Banana 2", "畅速", "高", "2K", "1:1",
|
"prompt", "Nano Banana 2", "畅速", "高", "2K", "1:1",
|
||||||
"1个路径", "D:\\images", "关闭", 0, "JPEG", "95",
|
"1个路径", "D:\\images", "关闭", 0, "JPEG", "95",
|
||||||
@@ -4033,3 +4153,32 @@ assert.match(migrationSource, /原生 seed 参数/);
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log("o1key image generator frontend tests passed");
|
console.log("o1key image generator frontend tests passed");
|
||||||
|
|
||||||
|
const nanoThinkingSource = fs.readFileSync(new URL("../web/js/nanoBananaThinkingLevel.js", import.meta.url), "utf8");
|
||||||
|
|
||||||
|
{
|
||||||
|
let thinkingExtension;
|
||||||
|
vm.runInNewContext(nanoThinkingSource.replace(/^import .*;\s*$/gm, ""), {
|
||||||
|
app: { registerExtension(extension) { thinkingExtension = extension; } },
|
||||||
|
requestAnimationFrame(callback) { callback(); },
|
||||||
|
});
|
||||||
|
for (const comfyClass of ["NanoBanana", "BatchNanoBananaPro"]) {
|
||||||
|
const model = { name: "模型", value: "Nano Banana 2.1", callback() { return "model-changed"; } };
|
||||||
|
const computeSize = () => [100, 20];
|
||||||
|
const thinking = { name: "思考等级", value: "高", computeSize };
|
||||||
|
const node = { comfyClass, widgets: [model, thinking], setDirtyCanvas() {} };
|
||||||
|
thinkingExtension.nodeCreated(node);
|
||||||
|
assert.equal(thinking.hidden, false);
|
||||||
|
assert.equal(thinking.options.hidden, false);
|
||||||
|
for (const value of ["Nano Banana Pro", "Nano Banana 2 Lite", "Nano Banana 2", "Nano Banana 2.1"]) {
|
||||||
|
model.value = value;
|
||||||
|
assert.equal(model.callback(), "model-changed");
|
||||||
|
assert.equal(thinking.hidden, !["Nano Banana 2", "Nano Banana 2.1"].includes(value));
|
||||||
|
assert.equal(thinking.value, "高");
|
||||||
|
}
|
||||||
|
assert.equal(thinking.computeSize, computeSize);
|
||||||
|
const callback = model.callback;
|
||||||
|
thinkingExtension.loadedGraphNode(node);
|
||||||
|
assert.equal(model.callback, callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class PayloadTests(unittest.TestCase):
|
|||||||
"智能",
|
"智能",
|
||||||
)
|
)
|
||||||
|
|
||||||
for model in ("Nano Banana 2", "gpt-image-2", "Seedream 5.0 Pro"):
|
for model in ("Nano Banana 2.1", "Nano Banana 2", "gpt-image-2", "Seedream 5.0 Pro"):
|
||||||
with self.subTest(model=model):
|
with self.subTest(model=model):
|
||||||
job = JOBS.normalize_job_payload({
|
job = JOBS.normalize_job_payload({
|
||||||
**_payload(),
|
**_payload(),
|
||||||
@@ -293,12 +293,13 @@ class PayloadTests(unittest.TestCase):
|
|||||||
"references": [{"name": "poster.png", "subfolder": "", "type": "input"}],
|
"references": [{"name": "poster.png", "subfolder": "", "type": "input"}],
|
||||||
})
|
})
|
||||||
|
|
||||||
def test_google_search_is_kept_only_for_nano_banana_2_when_true(self):
|
def test_google_search_is_kept_only_for_supported_nano_banana_models_when_true(self):
|
||||||
enabled = JOBS.normalize_job_payload({**_payload(), "google_search": True})
|
for model in ("Nano Banana 2.1", "Nano Banana 2"):
|
||||||
self.assertIs(enabled["google_search"], True)
|
with self.subTest(model=model):
|
||||||
|
enabled = JOBS.normalize_job_payload({**_payload(), "model": model, "google_search": True})
|
||||||
disabled = JOBS.normalize_job_payload({**_payload(), "google_search": False})
|
self.assertIs(enabled["google_search"], True)
|
||||||
self.assertNotIn("google_search", disabled)
|
disabled = JOBS.normalize_job_payload({**_payload(), "model": model, "google_search": False})
|
||||||
|
self.assertNotIn("google_search", disabled)
|
||||||
|
|
||||||
unsupported = JOBS.normalize_job_payload({
|
unsupported = JOBS.normalize_job_payload({
|
||||||
**_payload(),
|
**_payload(),
|
||||||
@@ -307,6 +308,18 @@ class PayloadTests(unittest.TestCase):
|
|||||||
})
|
})
|
||||||
self.assertNotIn("google_search", unsupported)
|
self.assertNotIn("google_search", unsupported)
|
||||||
|
|
||||||
|
def test_nano_banana_21_accepts_every_route_and_extended_aspect_ratio(self):
|
||||||
|
for route in ("畅速", "直连", "专线"):
|
||||||
|
for ratio in ("1:4", "1:8", "4:1", "8:1"):
|
||||||
|
with self.subTest(route=route, ratio=ratio):
|
||||||
|
job = JOBS.normalize_job_payload({
|
||||||
|
**_payload(), "model": "Nano Banana 2.1", "model_route": route,
|
||||||
|
"aspect_ratio": ratio, "google_search": True,
|
||||||
|
})
|
||||||
|
self.assertEqual(job["model"], "Nano Banana 2.1")
|
||||||
|
self.assertEqual(job["model_route"], route)
|
||||||
|
self.assertIs(job["google_search"], True)
|
||||||
|
|
||||||
def test_batch_prompts_expand_prompt_major_and_enforce_total_limit(self):
|
def test_batch_prompts_expand_prompt_major_and_enforce_total_limit(self):
|
||||||
job = JOBS.normalize_job_payload({
|
job = JOBS.normalize_job_payload({
|
||||||
**_payload(),
|
**_payload(),
|
||||||
@@ -997,7 +1010,7 @@ class NanoExecutionTests(unittest.IsolatedAsyncioTestCase):
|
|||||||
((0, 128, 0), (255, 255, 255)),
|
((0, 128, 0), (255, 255, 255)),
|
||||||
])
|
])
|
||||||
|
|
||||||
async def test_references_are_reused_as_exact_inline_data_without_urls(self):
|
async def test_nano_banana_21_reuses_inline_references_and_forwards_model_parameters(self):
|
||||||
calls = []
|
calls = []
|
||||||
|
|
||||||
class FakeHttpClient:
|
class FakeHttpClient:
|
||||||
@@ -1017,6 +1030,8 @@ class NanoExecutionTests(unittest.IsolatedAsyncioTestCase):
|
|||||||
Image.new("RGB", (5, 4), "orange").save(reference_path, format="JPEG")
|
Image.new("RGB", (5, 4), "orange").save(reference_path, format="JPEG")
|
||||||
job = JOBS.normalize_job_payload({
|
job = JOBS.normalize_job_payload({
|
||||||
**_payload(),
|
**_payload(),
|
||||||
|
"model": "Nano Banana 2.1",
|
||||||
|
"model_route": "专线",
|
||||||
"prompt": "第一条\n---\n第二条",
|
"prompt": "第一条\n---\n第二条",
|
||||||
"image_count": 2,
|
"image_count": 2,
|
||||||
"google_search": True,
|
"google_search": True,
|
||||||
@@ -1049,6 +1064,8 @@ class NanoExecutionTests(unittest.IsolatedAsyncioTestCase):
|
|||||||
self.assertEqual(len(calls), 4)
|
self.assertEqual(len(calls), 4)
|
||||||
self.assertTrue(all(call["download_semaphore"] is None for call in calls))
|
self.assertTrue(all(call["download_semaphore"] is None for call in calls))
|
||||||
self.assertTrue(all(call["google_search"] is True for call in calls))
|
self.assertTrue(all(call["google_search"] is True for call in calls))
|
||||||
|
self.assertTrue(all(call["model"] == "gemini-nano-banana-2.1" for call in calls))
|
||||||
|
self.assertTrue(all(call["thinking_level"] == "high" for call in calls))
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
[call["prompt"] for call in calls],
|
[call["prompt"] for call in calls],
|
||||||
["第一条", "第一条", "第二条", "第二条"],
|
["第一条", "第一条", "第二条", "第二条"],
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""Nano Banana 节点的展示模型、线路与 API 模型名映射。"""
|
"""Nano Banana 节点的展示模型、线路与 API 模型名映射。"""
|
||||||
|
|
||||||
NANO_BANANA_MODEL_OPTIONS = [
|
NANO_BANANA_MODEL_OPTIONS = [
|
||||||
|
"Nano Banana 2.1",
|
||||||
"Nano Banana 2",
|
"Nano Banana 2",
|
||||||
"Nano Banana Pro",
|
"Nano Banana Pro",
|
||||||
"Nano Banana 2 Lite",
|
"Nano Banana 2 Lite",
|
||||||
@@ -10,14 +11,17 @@ NANO_BANANA_MODEL_OPTIONS = [
|
|||||||
NANO_BANANA_ROUTE_OPTIONS = ["畅速", "直连", "专线"]
|
NANO_BANANA_ROUTE_OPTIONS = ["畅速", "直连", "专线"]
|
||||||
|
|
||||||
NANO_BANANA_MODEL_MATRIX = {
|
NANO_BANANA_MODEL_MATRIX = {
|
||||||
|
("Nano Banana 2.1", "畅速"): "gemini-nano-banana-2.1-sp",
|
||||||
("Nano Banana Pro", "畅速"): "gemini-3-pro-image-c-sp",
|
("Nano Banana Pro", "畅速"): "gemini-3-pro-image-c-sp",
|
||||||
("Nano Banana 2", "畅速"): "gemini-3.1-flash-image-c-sp",
|
("Nano Banana 2", "畅速"): "gemini-3.1-flash-image-c-sp",
|
||||||
("Nano Banana 2 Lite", "畅速"): "gemini-3.1-flash-lite-image-c-sp",
|
("Nano Banana 2 Lite", "畅速"): "gemini-3.1-flash-lite-image-c-sp",
|
||||||
("Nano Banana", "畅速"): "nano-banana",
|
("Nano Banana", "畅速"): "nano-banana",
|
||||||
|
("Nano Banana 2.1", "直连"): "gemini-nano-banana-2.1-sd",
|
||||||
("Nano Banana Pro", "直连"): "gemini-3-pro-image-c-sd",
|
("Nano Banana Pro", "直连"): "gemini-3-pro-image-c-sd",
|
||||||
("Nano Banana 2", "直连"): "gemini-3.1-flash-image-c-sd",
|
("Nano Banana 2", "直连"): "gemini-3.1-flash-image-c-sd",
|
||||||
("Nano Banana 2 Lite", "直连"): "gemini-3.1-flash-lite-image-c-sd",
|
("Nano Banana 2 Lite", "直连"): "gemini-3.1-flash-lite-image-c-sd",
|
||||||
("Nano Banana", "直连"): "nano-banana",
|
("Nano Banana", "直连"): "nano-banana",
|
||||||
|
("Nano Banana 2.1", "专线"): "gemini-nano-banana-2.1",
|
||||||
("Nano Banana Pro", "专线"): "gemini-3-pro-image",
|
("Nano Banana Pro", "专线"): "gemini-3-pro-image",
|
||||||
("Nano Banana 2", "专线"): "gemini-3.1-flash-image",
|
("Nano Banana 2", "专线"): "gemini-3.1-flash-image",
|
||||||
("Nano Banana 2 Lite", "专线"): "gemini-3.1-flash-lite-image",
|
("Nano Banana 2 Lite", "专线"): "gemini-3.1-flash-lite-image",
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ GPT_IMAGE_MODEL_OPTIONS = [
|
|||||||
]
|
]
|
||||||
SEEDREAM_MODEL_OPTIONS = ["Seedream 5.0 Pro"]
|
SEEDREAM_MODEL_OPTIONS = ["Seedream 5.0 Pro"]
|
||||||
UNIFIED_IMAGE_MODEL_OPTIONS = [
|
UNIFIED_IMAGE_MODEL_OPTIONS = [
|
||||||
*NANO_BANANA_MODEL_OPTIONS[:2],
|
*NANO_BANANA_MODEL_OPTIONS[:3],
|
||||||
*GPT_IMAGE_MODEL_OPTIONS,
|
*GPT_IMAGE_MODEL_OPTIONS,
|
||||||
*SEEDREAM_MODEL_OPTIONS,
|
*SEEDREAM_MODEL_OPTIONS,
|
||||||
*NANO_BANANA_MODEL_OPTIONS[2:],
|
*NANO_BANANA_MODEL_OPTIONS[3:],
|
||||||
]
|
]
|
||||||
UNIFIED_IMAGE_ROUTE_OPTIONS = list(NANO_BANANA_ROUTE_OPTIONS)
|
UNIFIED_IMAGE_ROUTE_OPTIONS = list(NANO_BANANA_ROUTE_OPTIONS)
|
||||||
|
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ def normalize_job_payload(payload: Any) -> dict[str, Any]:
|
|||||||
raise ValueError("模型无效")
|
raise ValueError("模型无效")
|
||||||
if model_route not in MODEL_ROUTES:
|
if model_route not in MODEL_ROUTES:
|
||||||
raise ValueError("模型线路无效")
|
raise ValueError("模型线路无效")
|
||||||
google_search = model == "Nano Banana 2" and payload.get("google_search") is True
|
google_search = model in {"Nano Banana 2.1", "Nano Banana 2"} and payload.get("google_search") is True
|
||||||
quality = str(payload.get("quality") or "自动").strip()
|
quality = str(payload.get("quality") or "自动").strip()
|
||||||
resize_mode = str(
|
resize_mode = str(
|
||||||
payload.get("resize_mode") or ("智能缩放" if is_gpt_image_model(model) else "不缩放")
|
payload.get("resize_mode") or ("智能缩放" if is_gpt_image_model(model) else "不缩放")
|
||||||
@@ -399,7 +399,7 @@ def normalize_job_payload(payload: Any) -> dict[str, Any]:
|
|||||||
raise ValueError("宽高比无效")
|
raise ValueError("宽高比无效")
|
||||||
if thinking not in THINKING_LEVELS:
|
if thinking not in THINKING_LEVELS:
|
||||||
raise ValueError("思考等级无效")
|
raise ValueError("思考等级无效")
|
||||||
if model not in {"Nano Banana 2", "Nano Banana 2 Lite"} and (
|
if model not in {"Nano Banana 2.1", "Nano Banana 2", "Nano Banana 2 Lite"} and (
|
||||||
resolution == "512" or aspect_ratio in {"1:4", "1:8", "4:1", "8:1"}
|
resolution == "512" or aspect_ratio in {"1:4", "1:8", "4:1", "8:1"}
|
||||||
):
|
):
|
||||||
raise ValueError("当前分辨率或宽高比仅支持 Nano Banana 2 系列")
|
raise ValueError("当前分辨率或宽高比仅支持 Nano Banana 2 系列")
|
||||||
@@ -807,7 +807,7 @@ async def _execute_nano_banana_job(
|
|||||||
batch_started_at = time.perf_counter()
|
batch_started_at = time.perf_counter()
|
||||||
thinking_level = (
|
thinking_level = (
|
||||||
THINKING_LEVELS[job["thinking_level"]]
|
THINKING_LEVELS[job["thinking_level"]]
|
||||||
if job["model"] == "Nano Banana 2"
|
if job["model"] in {"Nano Banana 2.1", "Nano Banana 2"}
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
api_key = get_api_key_or_raise("O1KEY_API_KEY")
|
api_key = get_api_key_or_raise("O1KEY_API_KEY")
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ function findLegacySeedanceAssetWidgets(wv) {
|
|||||||
: -1;
|
: -1;
|
||||||
}
|
}
|
||||||
const NANO_BANANA_MODELS = new Set([
|
const NANO_BANANA_MODELS = new Set([
|
||||||
"Nano Banana Pro", "Nano Banana 2 Lite", "Nano Banana 2", "Nano Banana",
|
"Nano Banana Pro", "Nano Banana 2 Lite", "Nano Banana 2.1", "Nano Banana 2", "Nano Banana",
|
||||||
]);
|
]);
|
||||||
const NANO_BANANA_ROUTE_ALIASES = new Map([
|
const NANO_BANANA_ROUTE_ALIASES = new Map([
|
||||||
["特价", "畅速"],
|
["特价", "畅速"],
|
||||||
@@ -229,6 +229,14 @@ function batchNanoRandomWidgetIndex(wv) {
|
|||||||
// 新增规则时:type 填节点的注册名(与保存文件里的 "type" 一致),
|
// 新增规则时:type 填节点的注册名(与保存文件里的 "type" 一致),
|
||||||
// when 判断旧结构特征(务必保证幂等,避免对已迁移的数据重复处理),apply 做数组修正。
|
// when 判断旧结构特征(务必保证幂等,避免对已迁移的数据重复处理),apply 做数组修正。
|
||||||
const MIGRATIONS = [
|
const MIGRATIONS = [
|
||||||
|
{
|
||||||
|
type: "O1keyImageGenerator",
|
||||||
|
note: "移除旧图片面板存档中的生成后控制占位,保持参数位置",
|
||||||
|
when: (wv) => Number.isInteger(wv[7])
|
||||||
|
&& ["fixed", "increment", "decrement", "randomize"].includes(wv[8])
|
||||||
|
&& typeof wv[9] === "string" && /^\s*\[/.test(wv[9]),
|
||||||
|
apply: (wv) => wv.splice(8, 1),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: "O1keyAutoRedCast",
|
type: "O1keyAutoRedCast",
|
||||||
note: "为旧版自动红偏校正补齐末尾 seed 参数",
|
note: "为旧版自动红偏校正补齐末尾 seed 参数",
|
||||||
@@ -1447,6 +1455,15 @@ app.registerExtension({
|
|||||||
migrated += migrateUnifiedOnlineSearch(container);
|
migrated += migrateUnifiedOnlineSearch(container);
|
||||||
migrated += migrateUnifiedLayerDecomposition(container);
|
migrated += migrateUnifiedLayerDecomposition(container);
|
||||||
migrated += migrateUnifiedModeration(container);
|
migrated += migrateUnifiedModeration(container);
|
||||||
|
for (const node of container?.nodes || []) {
|
||||||
|
const values = node?.widgets_values;
|
||||||
|
if (node?.type === "O1keyImageGenerator" && Array.isArray(values)
|
||||||
|
&& values.length === 24 && values[23] === ""
|
||||||
|
&& ["关闭", "打开"].includes(values[21]) && typeof values[22] === "boolean") {
|
||||||
|
values.pop(); // Retired non-serialized HTML panel value.
|
||||||
|
migrated++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (migrated > 0) {
|
if (migrated > 0) {
|
||||||
console.log(`[o1key] 工作流参数迁移:已修复 ${migrated} 处参数或端口`);
|
console.log(`[o1key] 工作流参数迁移:已修复 ${migrated} 处参数或端口`);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { app } from "../../../scripts/app.js";
|
|||||||
const NODE_TYPES = new Set(["NanoBanana", "BatchNanoBananaPro"]);
|
const NODE_TYPES = new Set(["NanoBanana", "BatchNanoBananaPro"]);
|
||||||
const MODEL_WIDGET = "模型";
|
const MODEL_WIDGET = "模型";
|
||||||
const THINKING_WIDGET = "思考等级";
|
const THINKING_WIDGET = "思考等级";
|
||||||
const SUPPORTED_MODEL = "Nano Banana 2";
|
const SUPPORTED_MODELS = new Set(["Nano Banana 2.1", "Nano Banana 2"]);
|
||||||
|
|
||||||
function findWidget(node, name) {
|
function findWidget(node, name) {
|
||||||
return node.widgets?.find((widget) => widget.name === name);
|
return node.widgets?.find((widget) => widget.name === name);
|
||||||
@@ -14,7 +14,7 @@ function setThinkingLevelVisibility(node) {
|
|||||||
const thinkingWidget = findWidget(node, THINKING_WIDGET);
|
const thinkingWidget = findWidget(node, THINKING_WIDGET);
|
||||||
if (!modelWidget || !thinkingWidget) return;
|
if (!modelWidget || !thinkingWidget) return;
|
||||||
|
|
||||||
const hidden = modelWidget.value !== SUPPORTED_MODEL;
|
const hidden = !SUPPORTED_MODELS.has(modelWidget.value);
|
||||||
if (thinkingWidget.__o1keyThinkingHidden === hidden) return;
|
if (thinkingWidget.__o1keyThinkingHidden === hidden) return;
|
||||||
thinkingWidget.__o1keyThinkingHidden = hidden;
|
thinkingWidget.__o1keyThinkingHidden = hidden;
|
||||||
|
|
||||||
|
|||||||
+127
-255
@@ -26,6 +26,7 @@ const GENERATOR_PANEL_MIN_HEIGHT = GENERATOR_MIN_SIZE[1] - GENERATOR_CHROME_HEIG
|
|||||||
const REFERENCE_LIGHTBOX_ID = "o1key-image-reference-lightbox";
|
const REFERENCE_LIGHTBOX_ID = "o1key-image-reference-lightbox";
|
||||||
const CANVAS_IMAGE_PICKER_ID = "o1key-canvas-image-picker";
|
const CANVAS_IMAGE_PICKER_ID = "o1key-canvas-image-picker";
|
||||||
const MODEL_OPTIONS = [
|
const MODEL_OPTIONS = [
|
||||||
|
{ value: "Nano Banana 2.1", label: "Nano Banana 2.1", description: "快速,批量" },
|
||||||
{ value: "Nano Banana 2", label: "Nano Banana 2", description: "快速,批量" },
|
{ value: "Nano Banana 2", label: "Nano Banana 2", description: "快速,批量" },
|
||||||
{ value: "Nano Banana Pro", label: "Nano Banana Pro", description: "高质量资产" },
|
{ value: "Nano Banana Pro", label: "Nano Banana Pro", description: "高质量资产" },
|
||||||
{ value: "gpt-image-2", label: "GPT Image 2", description: "高质量,编辑" },
|
{ value: "gpt-image-2", label: "GPT Image 2", description: "高质量,编辑" },
|
||||||
@@ -112,6 +113,7 @@ const GPT_IMAGE_MODELS = new Set([
|
|||||||
]);
|
]);
|
||||||
const isGptImageModel = (model) => GPT_IMAGE_MODELS.has(model);
|
const isGptImageModel = (model) => GPT_IMAGE_MODELS.has(model);
|
||||||
const MODEL_CAPABILITIES = Object.freeze({
|
const MODEL_CAPABILITIES = Object.freeze({
|
||||||
|
"Nano Banana 2.1": Object.freeze({ thinking: true, search: true, quality: false, output: false, mask: false, resize: true, saveFormat: true }),
|
||||||
"Nano Banana 2": Object.freeze({ thinking: true, search: true, quality: false, output: false, mask: false, resize: true, saveFormat: true }),
|
"Nano Banana 2": Object.freeze({ thinking: true, search: true, quality: false, output: false, mask: false, resize: true, saveFormat: true }),
|
||||||
"Nano Banana Pro": Object.freeze({ thinking: false, search: false, quality: false, output: false, mask: false, resize: true, saveFormat: true }),
|
"Nano Banana Pro": Object.freeze({ thinking: false, search: false, quality: false, output: false, mask: false, resize: true, saveFormat: true }),
|
||||||
"gpt-image-2": Object.freeze({ thinking: false, search: false, quality: true, output: true, mask: true, resize: true, saveFormat: false }),
|
"gpt-image-2": Object.freeze({ thinking: false, search: false, quality: true, output: true, mask: true, resize: true, saveFormat: false }),
|
||||||
@@ -129,288 +131,145 @@ const BACKEND_WIDGETS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const CSS = `
|
const CSS = `
|
||||||
.o1ig-panel{
|
/* Keep the image-generation panel and its interactions; only layout and theme are shared. */
|
||||||
width:100%;height:100%;min-height:292px;box-sizing:border-box;padding:10px 12px 12px;color:#e9e9e9;
|
.o1ig-panel,.o1ig-lightbox,.o1ig-canvas-picker{
|
||||||
font-family:Inter,"Microsoft YaHei UI","Microsoft YaHei","Noto Sans CJK SC",system-ui,sans-serif;
|
--o1ig-text:var(--input-text);
|
||||||
font-size:12px;line-height:1.5;
|
--o1ig-muted:var(--descrip-text);
|
||||||
display:flex;flex-direction:column;gap:10px;overflow:visible;user-select:none;
|
--o1ig-surface:var(--comfy-input-bg);
|
||||||
|
--o1ig-border:var(--border-color);
|
||||||
|
--o1ig-radius:var(--radius-lg,8px);
|
||||||
|
color:var(--o1ig-text);font-family:var(--font-sans,Inter,system-ui,sans-serif);
|
||||||
}
|
}
|
||||||
|
.lg-node-widget .o1ig-panel{
|
||||||
|
--o1ig-text:var(--component-node-foreground,var(--input-text));
|
||||||
|
--o1ig-muted:var(--component-node-foreground-secondary,var(--descrip-text));
|
||||||
|
--o1ig-surface:var(--component-node-widget-background,var(--comfy-input-bg));
|
||||||
|
--o1ig-border:var(--component-node-border,var(--border-color));
|
||||||
|
}
|
||||||
|
.o1ig-panel{
|
||||||
|
width:100%;height:100%;min-height:292px;box-sizing:border-box;padding:10px 12px 12px;
|
||||||
|
font-size:12px;line-height:1.5;display:flex;flex-direction:column;gap:8px;overflow:visible;user-select:none;
|
||||||
|
}
|
||||||
|
.o1ig-panel button,.o1ig-lightbox button,.o1ig-canvas-picker button{
|
||||||
|
border:1px solid var(--o1ig-border);background:var(--o1ig-surface);color:var(--o1ig-text);
|
||||||
|
font:inherit;box-shadow:none;
|
||||||
|
}
|
||||||
|
.o1ig-panel button:hover,.o1ig-lightbox button:hover,.o1ig-canvas-picker button:hover{
|
||||||
|
border-color:var(--o1ig-muted);background:var(--o1ig-surface);color:var(--o1ig-text);
|
||||||
|
}
|
||||||
|
.o1ig-panel button:focus-visible,.o1ig-lightbox button:focus-visible,.o1ig-canvas-picker button:focus-visible{
|
||||||
|
outline:1px solid currentColor;outline-offset:2px;
|
||||||
|
}
|
||||||
|
.o1ig-panel button:disabled{cursor:wait;opacity:.6;}
|
||||||
.o1ig-refs{
|
.o1ig-refs{
|
||||||
display:flex;flex:0 0 109px;box-sizing:border-box;gap:7px;min-height:109px;overflow-x:auto;overflow-y:hidden;
|
display:flex;flex:0 0 109px;box-sizing:border-box;gap:7px;min-height:109px;overflow-x:auto;overflow-y:hidden;
|
||||||
padding:1px 1px 4px;border-radius:9px;scrollbar-width:thin;scrollbar-color:#555 transparent;
|
padding:1px 1px 4px;border-radius:var(--o1ig-radius);scrollbar-width:thin;
|
||||||
transition:background .12s ease,box-shadow .12s ease;
|
|
||||||
}
|
|
||||||
.o1ig-refs.o1ig-reordering{background:rgba(150,184,136,.08);box-shadow:inset 0 0 0 1px rgba(173,205,158,.16);}
|
|
||||||
.o1ig-batch-bar{
|
|
||||||
display:flex;gap:8px;flex:0 0 auto;align-items:stretch;
|
|
||||||
}
|
}
|
||||||
|
.o1ig-refs.o1ig-reordering{outline:1px dashed var(--o1ig-border);outline-offset:2px;}
|
||||||
|
.o1ig-batch-bar{display:flex;gap:8px;flex:0 0 auto;align-items:stretch;}
|
||||||
.o1ig-batch-toggle{
|
.o1ig-batch-toggle{
|
||||||
flex:1;min-width:0;height:36px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 11px;
|
flex:1;min-width:0;height:28px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 11px;
|
||||||
box-sizing:border-box;border:1px solid rgba(255,255,255,.12);border-radius:8px;background:#202124;
|
box-sizing:border-box;border-radius:var(--o1ig-radius);cursor:pointer;font-size:11px;
|
||||||
color:#c5c7cc;cursor:pointer;font:inherit;font-size:11px;font-weight:650;letter-spacing:.035em;
|
|
||||||
}
|
}
|
||||||
.o1ig-batch-toggle:hover{border-color:rgba(255,255,255,.24);background:#202123;color:#fff;}
|
.o1ig-batch-switch{width:28px;height:16px;padding:2px;box-sizing:border-box;border:1px solid var(--o1ig-muted);border-radius:999px;}
|
||||||
.o1ig-batch-switch{width:28px;height:16px;padding:2px;box-sizing:border-box;border-radius:999px;background:#45474b;transition:.15s ease;}
|
.o1ig-batch-switch::after{content:"";display:block;width:10px;height:10px;border-radius:50%;background:var(--o1ig-muted);transition:transform .15s ease;}
|
||||||
.o1ig-batch-switch::after{content:"";display:block;width:12px;height:12px;border-radius:50%;background:#c8c9cb;transition:.15s ease;}
|
.o1ig-batch-toggle.enabled .o1ig-batch-switch::after{transform:translateX(12px);background:var(--o1ig-text);}
|
||||||
.o1ig-batch-toggle.enabled{border-color:rgba(173,205,158,.35);background:#202720;color:#dce8d7;}
|
|
||||||
.o1ig-batch-toggle.enabled .o1ig-batch-switch{background:#729466;}
|
|
||||||
.o1ig-batch-toggle.enabled .o1ig-batch-switch::after{transform:translateX(12px);background:#fff;}
|
|
||||||
.o1ig-batch-mode{display:none;flex:1;min-width:0;}.o1ig-batch-mode.visible{display:block;}
|
.o1ig-batch-mode{display:none;flex:1;min-width:0;}.o1ig-batch-mode.visible{display:block;}
|
||||||
.o1ig-assets{display:flex;flex-direction:column;gap:6px;min-width:0;}
|
.o1ig-assets{display:flex;flex-direction:column;gap:6px;min-width:0;}
|
||||||
.o1ig-asset-header{display:flex;align-items:center;gap:8px;min-height:30px;padding:0 2px;color:#aeb0b5;font-size:10px;line-height:16px;}
|
.o1ig-asset-header{display:flex;align-items:center;gap:8px;min-height:28px;padding:0 2px;color:var(--o1ig-muted);font-size:11px;}
|
||||||
.o1ig-asset-header strong{display:flex;align-items:center;gap:7px;color:#e5e6ea;font-size:11px;}
|
.o1ig-asset-header strong{display:flex;align-items:center;gap:7px;color:var(--o1ig-text);font-size:12px;font-weight:500;}
|
||||||
.o1ig-asset-header strong::before{content:"";width:3px;height:12px;border-radius:2px;background:#99aaff;}
|
|
||||||
.o1ig-asset-meta{display:flex;min-width:0;align-items:baseline;gap:7px;}
|
.o1ig-asset-meta{display:flex;min-width:0;align-items:baseline;gap:7px;}
|
||||||
.o1ig-asset-actions{display:flex;flex:0 0 auto;align-items:center;gap:5px;margin-left:auto;}
|
.o1ig-asset-actions{display:flex;flex:0 0 auto;align-items:center;gap:5px;margin-left:auto;}
|
||||||
.o1ig-asset-hint{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#82858a;}
|
.o1ig-asset-hint{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
||||||
.o1ig-model-assets{display:none;}.o1ig-model-assets.visible{display:flex;}
|
.o1ig-model-assets{display:none;}.o1ig-model-assets.visible{display:flex;}
|
||||||
.o1ig-batch-summary{display:none;min-height:18px;padding:5px 8px;box-sizing:border-box;border-radius:6px;
|
.o1ig-batch-summary{display:none;min-height:18px;padding:4px 0;color:var(--o1ig-muted);font-size:11px;}
|
||||||
background:rgba(125,151,114,.1);color:#b8c9b0;font-size:10px;line-height:1.45;}
|
|
||||||
.o1ig-batch-summary.visible{display:block;}
|
.o1ig-batch-summary.visible{display:block;}
|
||||||
.o1ig-thumb{
|
.o1ig-thumb{
|
||||||
position:relative;flex:0 0 102px;height:102px;box-sizing:border-box;border-radius:9px;
|
position:relative;flex:0 0 102px;height:102px;box-sizing:border-box;border-radius:var(--o1ig-radius);
|
||||||
border:1px solid rgba(255,255,255,.11);background:#1b1c1e;overflow:hidden;
|
border:1px solid var(--o1ig-border);background:var(--o1ig-surface);overflow:hidden;transition:transform .12s ease,opacity .12s ease;
|
||||||
box-shadow:inset 0 1px 0 rgba(255,255,255,.035),0 5px 14px rgba(0,0,0,.13);
|
|
||||||
transition:transform .12s ease,opacity .12s ease,filter .12s ease,box-shadow .12s ease,border-color .12s ease;
|
|
||||||
}
|
}
|
||||||
.o1ig-add{
|
.o1ig-add{position:relative;display:flex;flex:0 0 auto;height:28px;box-sizing:border-box;align-items:center;justify-content:center;gap:5px;padding:0 9px;border-radius:var(--o1ig-radius);cursor:pointer;}
|
||||||
position:relative;display:flex;flex:0 0 auto;height:30px;box-sizing:border-box;align-items:center;justify-content:center;gap:5px;
|
.o1ig-add b{font-size:15px;line-height:1;font-weight:400;}.o1ig-add span{font-size:11px;}
|
||||||
padding:0 9px;border:1px solid rgba(255,255,255,.11);border-radius:7px;background:#1b1c1e;
|
|
||||||
color:#aaa;cursor:pointer;transition:.15s ease;font:inherit;font-size:10px;
|
|
||||||
}
|
|
||||||
.o1ig-add:hover,.o1ig-add.drag{background:#232426;border-color:rgba(255,255,255,.28);color:#fff;}
|
|
||||||
.o1ig-add b{font-size:15px;line-height:1;font-weight:400;}.o1ig-add span{font-size:10px;}
|
|
||||||
.o1ig-canvas-pick b{font-size:13px;line-height:1;}
|
.o1ig-canvas-pick b{font-size:13px;line-height:1;}
|
||||||
.o1ig-thumb img{width:100%;height:100%;display:block;object-fit:contain;background:#111;}
|
.o1ig-thumb img{width:100%;height:100%;display:block;object-fit:contain;background:var(--o1ig-surface);}
|
||||||
.o1ig-thumb .o1ig-edit{
|
.o1ig-thumb .o1ig-edit{position:absolute;top:5px;left:5px;z-index:2;width:25px;height:25px;padding:0;display:grid;place-items:center;border-radius:6px;cursor:pointer;font-size:15px;opacity:.84;}
|
||||||
position:absolute;top:5px;left:5px;z-index:2;width:25px;height:25px;padding:0;display:grid;place-items:center;
|
|
||||||
border:1px solid rgba(255,255,255,.18);border-radius:6px;background:rgba(10,10,10,.78);color:#e7e7e7;
|
|
||||||
cursor:pointer;font:700 15px/1 system-ui,sans-serif;opacity:.84;transition:opacity .12s ease,background .12s ease;
|
|
||||||
}
|
|
||||||
.o1ig-thumb:hover .o1ig-edit,.o1ig-thumb .o1ig-edit:focus-visible{opacity:1;}
|
.o1ig-thumb:hover .o1ig-edit,.o1ig-thumb .o1ig-edit:focus-visible{opacity:1;}
|
||||||
.o1ig-thumb .o1ig-edit:hover{background:#eef0ed;color:#151715;border-color:#fff;}
|
.o1ig-thumb .o1ig-replace{position:absolute;right:5px;bottom:5px;z-index:2;height:22px;padding:0 7px;border-radius:6px;cursor:pointer;font-size:10px;}
|
||||||
.o1ig-thumb .o1ig-replace{
|
.o1ig-thumb .o1ig-remove{position:absolute;top:5px;right:5px;width:23px;height:23px;padding:0;border-radius:6px;cursor:pointer;font-size:14px;opacity:0;}
|
||||||
position:absolute;right:5px;bottom:5px;z-index:2;height:22px;padding:0 7px;
|
.o1ig-thumb:hover .o1ig-remove,.o1ig-thumb .o1ig-remove:focus-visible{opacity:1;}
|
||||||
border:1px solid rgba(255,255,255,.46);border-radius:6px;background:rgba(10,10,10,.78);
|
.o1ig-thumb.previewable{cursor:grab;}.o1ig-thumb.previewable:active{cursor:grabbing;}.o1ig-thumb.sort-locked{cursor:zoom-in;}
|
||||||
color:#fff;cursor:pointer;font:600 10px/20px system-ui,sans-serif;text-shadow:0 1px 2px rgba(0,0,0,.75);
|
.o1ig-thumb.o1ig-dragging{opacity:.3;transform:scale(.91);outline:2px solid currentColor;}
|
||||||
box-shadow:0 2px 5px rgba(0,0,0,.34),inset 0 1px 0 rgba(255,255,255,.1);
|
.o1ig-thumb.o1ig-dragging::before{content:"移动中";position:absolute;inset:0;z-index:4;display:grid;place-items:center;background:var(--o1ig-surface);font-size:11px;pointer-events:none;}
|
||||||
}
|
|
||||||
.o1ig-thumb .o1ig-replace:hover,.o1ig-thumb .o1ig-replace:focus-visible{
|
|
||||||
border-color:rgba(255,255,255,.75);background:rgba(10,10,10,.92);color:#fff;
|
|
||||||
}
|
|
||||||
.o1ig-thumb .o1ig-replace:disabled{cursor:wait;opacity:.6;}
|
|
||||||
.o1ig-thumb .o1ig-remove{
|
|
||||||
position:absolute;top:5px;right:5px;width:23px;height:23px;padding:0;border:0;border-radius:6px;
|
|
||||||
background:rgba(10,10,10,.76);color:#ddd;cursor:pointer;line-height:23px;font-size:14px;
|
|
||||||
opacity:0;transition:opacity .12s ease;
|
|
||||||
}
|
|
||||||
.o1ig-thumb:hover .o1ig-remove{opacity:1;}.o1ig-thumb .o1ig-remove:hover{color:#fff;background:#050505;}
|
|
||||||
.o1ig-thumb.previewable{cursor:grab;}
|
|
||||||
.o1ig-thumb.previewable:active{cursor:grabbing;}
|
|
||||||
.o1ig-thumb.sort-locked{cursor:zoom-in;}
|
|
||||||
.o1ig-thumb.o1ig-dragging{
|
|
||||||
opacity:.3;filter:brightness(.52) saturate(.45);transform:scale(.91);
|
|
||||||
border-color:rgba(194,220,184,.72);box-shadow:inset 0 0 0 2px rgba(194,220,184,.5),0 2px 7px rgba(0,0,0,.24);
|
|
||||||
}
|
|
||||||
.o1ig-thumb.o1ig-dragging::before{
|
|
||||||
content:"移动中";position:absolute;inset:0;z-index:4;display:grid;place-items:center;
|
|
||||||
background:rgba(12,15,12,.38);color:#f2f6f0;font-size:11px;font-weight:700;letter-spacing:.08em;pointer-events:none;
|
|
||||||
}
|
|
||||||
.o1ig-thumb.o1ig-dragging .o1ig-remove,.o1ig-thumb.o1ig-dragging .o1ig-replace{display:none;}
|
.o1ig-thumb.o1ig-dragging .o1ig-remove,.o1ig-thumb.o1ig-dragging .o1ig-replace{display:none;}
|
||||||
.o1ig-thumb.replacing::after{
|
.o1ig-thumb.replacing::after{content:"替换中…";position:absolute;inset:0;z-index:3;display:grid;place-items:center;background:var(--o1ig-surface);font-size:11px;pointer-events:none;}
|
||||||
content:"替换中…";position:absolute;inset:0;z-index:3;display:grid;place-items:center;
|
.o1ig-thumb.o1ig-drop-before{transform:translateX(7px);box-shadow:inset 4px 0 currentColor;}
|
||||||
background:rgba(10,13,23,.65);color:#fff;font-size:11px;font-weight:700;pointer-events:none;
|
.o1ig-thumb.o1ig-drop-after{transform:translateX(-7px);box-shadow:inset -4px 0 currentColor;}
|
||||||
}
|
|
||||||
.o1ig-thumb.o1ig-drop-before{transform:translateX(7px);box-shadow:inset 5px 0 0 #dcebd6,0 8px 20px rgba(0,0,0,.2);}
|
|
||||||
.o1ig-thumb.o1ig-drop-after{transform:translateX(-7px);box-shadow:inset -5px 0 0 #dcebd6,0 8px 20px rgba(0,0,0,.2);}
|
|
||||||
.o1ig-thumb img.o1ig-previewable{cursor:inherit;}
|
.o1ig-thumb img.o1ig-previewable{cursor:inherit;}
|
||||||
.o1ig-thumb img.o1ig-previewable:focus-visible{outline:2px solid rgba(255,255,255,.9);outline-offset:-3px;}
|
.o1ig-thumb img.o1ig-previewable:focus-visible{outline:2px solid currentColor;outline-offset:-3px;}
|
||||||
.o1ig-reference-index{
|
.o1ig-reference-index{position:absolute;left:5px;bottom:5px;z-index:1;min-width:23px;height:22px;padding:0 6px;box-sizing:border-box;display:grid;place-items:center;border:1px solid var(--o1ig-border);border-radius:6px;background:var(--o1ig-surface);font-size:11px;line-height:1;pointer-events:none;}
|
||||||
position:absolute;left:5px;bottom:5px;z-index:1;min-width:23px;height:22px;padding:0 6px;box-sizing:border-box;
|
.o1ig-thumb.pending::after{content:'···';position:absolute;inset:0;display:grid;place-items:center;background:var(--o1ig-surface);letter-spacing:2px;}
|
||||||
display:grid;place-items:center;border:1px solid rgba(255,255,255,.46);border-radius:6px;background:rgba(10,10,10,.78);
|
.o1ig-empty-reference{flex:0 0 102px;height:102px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border-style:dashed!important;border-radius:var(--o1ig-radius);cursor:pointer;}
|
||||||
color:#fff;font-size:11px;font-weight:700;line-height:1;text-shadow:0 1px 2px rgba(0,0,0,.75);
|
.o1ig-empty-reference:hover,.o1ig-empty-reference.drag{outline:1px dashed currentColor;outline-offset:-4px;}
|
||||||
box-shadow:0 2px 5px rgba(0,0,0,.34),inset 0 1px 0 rgba(255,255,255,.1);pointer-events:none;
|
.o1ig-empty-reference b{font-size:22px;line-height:1;font-weight:300;}.o1ig-empty-reference span{font-size:11px;}
|
||||||
}
|
.o1ig-lightbox{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--bg-color) 94%,transparent);outline:none;}
|
||||||
.o1ig-thumb.pending::after{
|
|
||||||
content:'···';position:absolute;inset:0;display:grid;place-items:center;
|
|
||||||
background:rgba(10,10,10,.52);color:#fff;letter-spacing:2px;
|
|
||||||
}
|
|
||||||
.o1ig-empty-reference{
|
|
||||||
flex:0 0 102px;height:102px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
|
|
||||||
border:1px dashed rgba(164,179,255,.28);border-radius:9px;background:#202228;color:#aeb7d6;cursor:pointer;font:inherit;
|
|
||||||
}
|
|
||||||
.o1ig-empty-reference:hover,.o1ig-empty-reference.drag{border-color:#aab9ff;background:#292e3d;color:#fff;}
|
|
||||||
.o1ig-empty-reference b{font-size:22px;line-height:1;font-weight:300;}.o1ig-empty-reference span{font-size:10px;}
|
|
||||||
.o1ig-lightbox{
|
|
||||||
position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;
|
|
||||||
background:rgba(0,0,0,.9);outline:none;
|
|
||||||
}
|
|
||||||
.o1ig-lightbox[aria-hidden="true"]{display:none;}
|
.o1ig-lightbox[aria-hidden="true"]{display:none;}
|
||||||
.o1ig-lightbox-image{display:block;width:auto;height:auto;max-width:90vw;max-height:90vh;border-radius:4px;object-fit:contain;}
|
.o1ig-lightbox-image{display:block;width:auto;height:auto;max-width:90vw;max-height:90vh;border-radius:4px;object-fit:contain;}
|
||||||
.o1ig-lightbox-button{
|
.o1ig-lightbox-button{position:fixed;z-index:1;width:44px;height:44px;padding:0;display:grid;place-items:center;border-radius:50%;cursor:pointer;font-size:30px!important;}
|
||||||
position:fixed;z-index:1;width:44px;height:44px;padding:0;display:grid;place-items:center;
|
.o1ig-lightbox-close{top:16px;right:16px;font-size:27px!important;}.o1ig-lightbox-previous{top:50%;left:16px;transform:translateY(-50%);}.o1ig-lightbox-next{top:50%;right:16px;transform:translateY(-50%);}
|
||||||
border:1px solid rgba(255,255,255,.14);border-radius:50%;background:#2b2c2f;color:#f3f3f3;
|
.o1ig-canvas-picker{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;background:color-mix(in srgb,var(--bg-color) 76%,transparent);}
|
||||||
box-shadow:0 8px 22px rgba(0,0,0,.32);cursor:pointer;font:400 30px/1 system-ui,sans-serif;
|
.o1ig-canvas-picker-dialog{width:min(840px,92vw);max-height:min(720px,88vh);display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--o1ig-border);border-radius:12px;background:var(--comfy-menu-bg);}
|
||||||
}
|
.o1ig-canvas-picker-header{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--o1ig-border);}
|
||||||
.o1ig-lightbox-button:hover,.o1ig-lightbox-button:focus-visible{background:#3a3b3f;color:#fff;outline:2px solid rgba(255,255,255,.8);outline-offset:2px;}
|
.o1ig-canvas-picker-header strong{flex:1;font-size:15px;font-weight:500;}.o1ig-canvas-picker-header span{color:var(--o1ig-muted);font-size:11px;}
|
||||||
.o1ig-lightbox-close{top:16px;right:16px;font-size:27px;}
|
.o1ig-canvas-picker-close{width:30px;height:30px;padding:0;border-radius:7px;cursor:pointer;font-size:20px!important;}
|
||||||
.o1ig-lightbox-previous{top:50%;left:16px;transform:translateY(-50%);}
|
.o1ig-canvas-picker-grid{min-height:140px;padding:14px;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:10px;}
|
||||||
.o1ig-lightbox-next{top:50%;right:16px;transform:translateY(-50%);}
|
.o1ig-canvas-picker-card{min-width:0;padding:0;overflow:hidden;border-radius:9px;cursor:pointer;text-align:left;}
|
||||||
.o1ig-canvas-picker{
|
|
||||||
position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;padding:24px;
|
|
||||||
box-sizing:border-box;background:rgba(0,0,0,.76);font-family:Inter,"Microsoft YaHei UI","Microsoft YaHei",system-ui,sans-serif;
|
|
||||||
}
|
|
||||||
.o1ig-canvas-picker-dialog{
|
|
||||||
width:min(840px,92vw);max-height:min(720px,88vh);display:flex;flex-direction:column;overflow:hidden;
|
|
||||||
border:1px solid rgba(255,255,255,.16);border-radius:12px;background:#202124;color:#f1f1f1;
|
|
||||||
box-shadow:0 24px 70px rgba(0,0,0,.56);
|
|
||||||
}
|
|
||||||
.o1ig-canvas-picker-header{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid rgba(255,255,255,.1);}
|
|
||||||
.o1ig-canvas-picker-header strong{flex:1;font-size:15px;}.o1ig-canvas-picker-header span{color:#999;font-size:11px;}
|
|
||||||
.o1ig-canvas-picker-close{width:30px;height:30px;padding:0;border:0;border-radius:7px;background:#303136;color:#ddd;cursor:pointer;font-size:20px;}
|
|
||||||
.o1ig-canvas-picker-close:hover{background:#3a3b3e;color:#fff;}
|
|
||||||
.o1ig-canvas-picker-grid{
|
|
||||||
min-height:140px;padding:14px;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:10px;
|
|
||||||
}
|
|
||||||
.o1ig-canvas-picker-card{
|
|
||||||
min-width:0;padding:0;overflow:hidden;border:1px solid rgba(255,255,255,.11);border-radius:9px;background:#18191b;
|
|
||||||
color:#ddd;cursor:pointer;text-align:left;font:inherit;
|
|
||||||
}
|
|
||||||
.o1ig-canvas-picker-card:hover,.o1ig-canvas-picker-card:focus-visible{border-color:rgba(255,255,255,.4);background:#242527;outline:none;}
|
|
||||||
.o1ig-canvas-picker-card:disabled{cursor:wait;opacity:.65;}
|
.o1ig-canvas-picker-card:disabled{cursor:wait;opacity:.65;}
|
||||||
.o1ig-canvas-picker-card img{display:block;width:100%;height:118px;object-fit:contain;background:#111;}
|
.o1ig-canvas-picker-card img{display:block;width:100%;height:118px;object-fit:contain;background:var(--o1ig-surface);}
|
||||||
.o1ig-canvas-picker-card strong,.o1ig-canvas-picker-card span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 8px;}
|
.o1ig-canvas-picker-card strong,.o1ig-canvas-picker-card span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0 8px;}
|
||||||
.o1ig-canvas-picker-card strong{padding-top:7px;color:#eee;font-size:11px;}.o1ig-canvas-picker-card span{padding-top:2px;padding-bottom:8px;color:#8f9297;font-size:10px;}
|
.o1ig-canvas-picker-card strong{padding-top:7px;font-size:11px;font-weight:500;}.o1ig-canvas-picker-card span{padding-top:2px;padding-bottom:8px;color:var(--o1ig-muted);font-size:10px;}
|
||||||
.o1ig-canvas-picker-empty{grid-column:1/-1;display:grid;place-items:center;min-height:150px;color:#999;text-align:center;font-size:12px;}
|
.o1ig-canvas-picker-empty{grid-column:1/-1;display:grid;place-items:center;min-height:150px;color:var(--o1ig-muted);text-align:center;font-size:12px;}
|
||||||
.o1ig-prompt-wrap{position:relative;width:100%;height:auto;min-height:142px;flex:1 1 142px;min-width:0;overflow:visible;}
|
.o1ig-prompt-wrap{position:relative;width:100%;height:auto;min-height:142px;flex:1 1 142px;min-width:0;overflow:visible;}
|
||||||
.o1ig-prompt{
|
.o1ig-prompt{width:100%;height:100%;min-height:142px;max-height:none;resize:none;box-sizing:border-box;padding:10px 12px 40px;border:1px solid var(--o1ig-border);border-radius:var(--o1ig-radius);background:var(--o1ig-surface);color:var(--o1ig-text);outline:none;font:inherit;font-size:12px;line-height:1.55;user-select:text;}
|
||||||
width:100%;height:100%;min-height:142px;max-height:none;resize:none;
|
.o1ig-prompt::placeholder{color:var(--o1ig-muted);}.o1ig-prompt:focus{border-color:var(--o1ig-muted);}
|
||||||
box-sizing:border-box;padding:13px 45px 40px 13px;border:1px solid rgba(255,255,255,.12);
|
.o1ig-prompt-optimize{position:absolute;right:8px;bottom:8px;min-width:96px;height:28px;padding:0 9px;display:flex;align-items:center;justify-content:center;gap:5px;border-radius:7px;cursor:pointer;font-size:11px!important;line-height:1;white-space:nowrap;}
|
||||||
border-radius:10px;background:#202124;color:#f2f2f2;outline:none;
|
|
||||||
font:inherit;font-size:12px;line-height:1.55;user-select:text;
|
|
||||||
box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
|
|
||||||
transition:border-color .15s ease,background .15s ease;
|
|
||||||
}
|
|
||||||
.o1ig-prompt::placeholder{color:#8f929b;}.o1ig-prompt:focus{background:#22242a;border-color:#91a3ef;box-shadow:0 0 0 2px rgba(145,163,239,.13);}
|
|
||||||
.o1ig-prompt-optimize{
|
|
||||||
position:absolute;right:8px;bottom:8px;min-width:96px;height:28px;padding:0 9px;display:flex;align-items:center;justify-content:center;gap:5px;
|
|
||||||
border:1px solid rgba(255,255,255,.11);border-radius:7px;background:rgba(35,36,39,.92);color:#aaa;
|
|
||||||
cursor:pointer;font:inherit;font-size:11px;font-weight:700;line-height:1;white-space:nowrap;
|
|
||||||
transition:color .15s ease,background .15s ease,border-color .15s ease,transform .15s ease;
|
|
||||||
}
|
|
||||||
.o1ig-prompt-optimize-icon{display:block;font-size:15px;line-height:1;transform-origin:center;}
|
.o1ig-prompt-optimize-icon{display:block;font-size:15px;line-height:1;transform-origin:center;}
|
||||||
.o1ig-prompt-optimize:hover,.o1ig-prompt-optimize:focus-visible{color:#fff;background:#303136;border-color:rgba(255,255,255,.26);outline:none;transform:translateY(-1px);}
|
|
||||||
.o1ig-prompt-optimize:disabled{cursor:wait;color:#d8c278;opacity:.9;transform:none;}
|
|
||||||
.o1ig-prompt-optimize.busy .o1ig-prompt-optimize-icon{animation:o1ig-magic-pulse .9s ease-in-out infinite alternate;}
|
.o1ig-prompt-optimize.busy .o1ig-prompt-optimize-icon{animation:o1ig-magic-pulse .9s ease-in-out infinite alternate;}
|
||||||
@keyframes o1ig-magic-pulse{from{transform:rotate(-5deg) scale(.92);opacity:.58}to{transform:rotate(5deg) scale(1.08);opacity:1}}
|
@keyframes o1ig-magic-pulse{from{transform:rotate(-5deg) scale(.92);opacity:.58}to{transform:rotate(5deg) scale(1.08);opacity:1}}
|
||||||
.o1ig-prompt-optimize-status{
|
.o1ig-prompt-optimize-status{position:absolute;right:112px;bottom:10px;z-index:1;display:none;align-items:center;gap:6px;max-width:calc(100% - 128px);height:24px;box-sizing:border-box;padding:0 7px;border-radius:6px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;background:var(--o1ig-surface);color:var(--o1ig-muted);font-size:10px;line-height:24px;}
|
||||||
position:absolute;right:112px;bottom:10px;z-index:1;display:none;align-items:center;gap:6px;
|
|
||||||
max-width:calc(100% - 128px);height:24px;box-sizing:border-box;padding:0 7px;border-radius:6px;
|
|
||||||
overflow:hidden;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;
|
|
||||||
background:rgba(25,26,28,.9);color:#aeb0b5;font-size:10px;line-height:24px;
|
|
||||||
}
|
|
||||||
.o1ig-prompt-optimize-status.visible{display:flex;}
|
.o1ig-prompt-optimize-status.visible{display:flex;}
|
||||||
.o1ig-prompt-optimize-status.busy{color:#d8c278;}
|
.o1ig-prompt-optimize-status.busy::before{content:"";flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:currentColor;animation:o1ig-prompt-status-pulse .8s ease-in-out infinite alternate;}
|
||||||
.o1ig-prompt-optimize-status.ok{color:#a8c89a;}
|
|
||||||
.o1ig-prompt-optimize-status.error{color:#d3a0a0;}
|
|
||||||
.o1ig-prompt-optimize-status.busy::before{
|
|
||||||
content:"";flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:currentColor;
|
|
||||||
animation:o1ig-prompt-status-pulse .8s ease-in-out infinite alternate;
|
|
||||||
}
|
|
||||||
@keyframes o1ig-prompt-status-pulse{from{opacity:.35;transform:scale(.8)}to{opacity:1;transform:scale(1.12)}}
|
@keyframes o1ig-prompt-status-pulse{from{opacity:.35;transform:scale(.8)}to{opacity:1;transform:scale(1.12)}}
|
||||||
.o1ig-toolbar{width:100%;min-width:0;display:grid;flex:0 0 auto;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px 10px;position:relative;overflow:visible;}
|
.o1ig-toolbar{width:100%;min-width:0;display:grid;flex:0 0 auto;grid-template-columns:minmax(0,1fr);gap:6px;position:relative;overflow:visible;}
|
||||||
.o1ig-section-title{grid-column:1/-1;display:flex;align-items:center;gap:9px;min-height:18px;margin-top:2px;color:#cfd2db;font-size:11px;font-weight:700;letter-spacing:.04em;}
|
.o1ig-section-title{grid-column:1/-1;display:flex;align-items:center;gap:9px;min-height:18px;margin-top:2px;color:var(--o1ig-muted);font-size:11px;font-weight:500;}
|
||||||
.o1ig-section-title::after{content:"";height:1px;flex:1;background:rgba(255,255,255,.1);}
|
.o1ig-section-title::after{content:"";height:1px;flex:1;background:var(--o1ig-border);}
|
||||||
.o1ig-field-wide{grid-column:1/-1;}
|
.o1ig-field-wide{grid-column:1/-1;}
|
||||||
.o1ig-control{
|
.o1ig-control{width:100%;height:28px;min-width:0;box-sizing:border-box;padding:0 9px;border:1px solid var(--o1ig-border);border-radius:var(--o1ig-radius);background:var(--o1ig-surface);color:var(--o1ig-text);outline:none;font:inherit;font-size:12px;line-height:1.4;font-variant-numeric:tabular-nums;}
|
||||||
width:100%;height:34px;min-width:0;box-sizing:border-box;padding:0 9px;
|
.o1ig-control:hover,.o1ig-control:focus{border-color:var(--o1ig-muted);}
|
||||||
border:1px solid rgba(255,255,255,.12);border-radius:8px;background:#202124;color:#ececf0;
|
.o1ig-select{position:relative;min-width:0;height:28px;z-index:1;}.o1ig-select.open{z-index:50;}
|
||||||
outline:none;font:inherit;font-size:12px;font-weight:500;line-height:1.4;letter-spacing:.035em;
|
.o1ig-select-trigger{width:100%;height:28px;min-width:0;display:flex;align-items:center;gap:6px;box-sizing:border-box;padding:0 7px 0 9px;border-radius:var(--o1ig-radius);cursor:pointer;text-align:left;font-size:12px!important;line-height:1.4;font-variant-numeric:tabular-nums;}
|
||||||
font-variant-numeric:tabular-nums;box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
|
|
||||||
}
|
|
||||||
.o1ig-control:hover{border-color:rgba(255,255,255,.28);background:#25262a;}
|
|
||||||
.o1ig-control:focus{border-color:#91a3ef;background:#25262a;box-shadow:0 0 0 2px rgba(145,163,239,.13);}
|
|
||||||
.o1ig-select{position:relative;min-width:0;height:34px;z-index:1;}
|
|
||||||
.o1ig-select.open{z-index:50;}
|
|
||||||
.o1ig-select-trigger{
|
|
||||||
width:100%;height:34px;min-width:0;display:flex;align-items:center;gap:6px;box-sizing:border-box;padding:0 7px 0 9px;
|
|
||||||
border:1px solid rgba(255,255,255,.12);border-radius:8px;background:#202124;color:#ececf0;cursor:pointer;
|
|
||||||
font:inherit;font-size:12px;font-weight:500;line-height:1.4;letter-spacing:.035em;font-variant-numeric:tabular-nums;
|
|
||||||
text-align:left;box-shadow:inset 0 1px 0 rgba(255,255,255,.025);transition:.14s ease;
|
|
||||||
}
|
|
||||||
.o1ig-select-trigger:hover{border-color:rgba(255,255,255,.28);background:#25262a;color:#fff;}
|
|
||||||
.o1ig-select-trigger:focus-visible{outline:2px solid #91a3ef;outline-offset:1px;}
|
|
||||||
.o1ig-select.open .o1ig-select-trigger{
|
|
||||||
border-color:#91a3ef;background:#292b32;color:#fff;
|
|
||||||
box-shadow:0 7px 18px rgba(0,0,0,.3),inset 0 1px 0 rgba(255,255,255,.08);
|
|
||||||
}
|
|
||||||
.o1ig-select-value{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4;}
|
.o1ig-select-value{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:1.4;}
|
||||||
.o1ig-select-selected-description{
|
.o1ig-select-selected-description{flex:0 0 auto;max-width:42%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--o1ig-muted);font-size:10px;line-height:1.35;}
|
||||||
flex:0 0 auto;max-width:42%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 6px;
|
|
||||||
border:1px solid rgba(255,255,255,.1);border-radius:999px;background:rgba(255,255,255,.07);
|
|
||||||
color:#aeb0b5;font-size:10px;font-weight:600;line-height:1.35;letter-spacing:.04em;
|
|
||||||
}
|
|
||||||
.o1ig-select-selected-description:empty{display:none;}
|
.o1ig-select-selected-description:empty{display:none;}
|
||||||
.o1ig-select-caret{
|
.o1ig-select-caret{width:14px;height:14px;flex:0 0 14px;display:flex;align-items:center;justify-content:center;align-self:center;line-height:0;transform-origin:50% 50%;transition:transform .14s ease;}
|
||||||
width:14px;height:14px;flex:0 0 14px;display:flex;align-items:center;justify-content:center;align-self:center;
|
.o1ig-select-caret svg{display:block;width:12px;height:12px;overflow:visible;}.o1ig-select.open .o1ig-select-caret{transform:rotate(180deg);}
|
||||||
color:#aaa;line-height:0;transform-origin:50% 50%;transition:transform .14s ease,color .14s ease;
|
.o1ig-select-menu{position:absolute;top:32px;left:0;min-width:100%;width:100%;display:none;box-sizing:border-box;padding:5px;border:1px solid var(--o1ig-border);border-radius:var(--o1ig-radius);background:var(--comfy-menu-bg);}
|
||||||
}
|
|
||||||
.o1ig-select-caret svg{display:block;width:12px;height:12px;overflow:visible;}
|
|
||||||
.o1ig-select-trigger:hover .o1ig-select-caret,.o1ig-select.open .o1ig-select-caret{color:#fff;}
|
|
||||||
.o1ig-select.open .o1ig-select-caret{transform:rotate(180deg);}
|
|
||||||
.o1ig-select-menu{
|
|
||||||
position:absolute;top:40px;left:0;min-width:100%;width:max-content;max-width:300px;display:none;box-sizing:border-box;
|
|
||||||
padding:5px;border:1px solid rgba(255,255,255,.18);border-radius:9px;background:#202123;
|
|
||||||
box-shadow:0 15px 32px rgba(0,0,0,.48),inset 0 1px 0 rgba(255,255,255,.055);
|
|
||||||
}
|
|
||||||
.o1ig-select.open .o1ig-select-menu{display:grid;gap:2px;}
|
.o1ig-select.open .o1ig-select-menu{display:grid;gap:2px;}
|
||||||
.o1ig-select-option{
|
.o1ig-panel .o1ig-select-option{min-width:100%;min-height:28px;box-sizing:border-box;padding:5px 9px;border:0;border-radius:5px;display:flex;align-items:center;cursor:pointer;font-size:12px;line-height:1.4;text-align:left;white-space:nowrap;}
|
||||||
min-width:100%;min-height:30px;box-sizing:border-box;padding:7px 9px;border:0;border-radius:5px;background:transparent;color:#bfc0c3;
|
|
||||||
display:flex;align-items:center;cursor:pointer;font:inherit;font-size:12px;font-weight:500;line-height:1.4;
|
|
||||||
letter-spacing:.035em;font-variant-numeric:tabular-nums;text-align:left;white-space:nowrap;transition:background .12s ease,color .12s ease;
|
|
||||||
}
|
|
||||||
.o1ig-select-option.has-description{gap:14px;justify-content:space-between;}
|
.o1ig-select-option.has-description{gap:14px;justify-content:space-between;}
|
||||||
.o1ig-select-option-label{min-width:0;overflow:hidden;text-overflow:ellipsis;}
|
.o1ig-select-option-label{min-width:0;overflow:hidden;text-overflow:ellipsis;}
|
||||||
.o1ig-select-option-description{
|
.o1ig-select-option-description{flex:0 0 auto;color:var(--o1ig-muted);font-size:10px;line-height:1.35;}
|
||||||
flex:0 0 auto;padding:2px 6px;border:1px solid rgba(255,255,255,.1);border-radius:999px;
|
.o1ig-panel .o1ig-select-option.selected{outline:1px solid var(--o1ig-muted);outline-offset:-1px;font-weight:600;}
|
||||||
background:rgba(255,255,255,.07);color:#aeb0b5;font-size:10px;font-weight:600;line-height:1.35;letter-spacing:.04em;
|
.o1ig-field{display:grid;grid-template-columns:104px minmax(0,1fr);align-items:center;gap:4px 8px;min-width:0;}
|
||||||
}
|
.o1ig-field label{min-width:0;font-size:11px;font-weight:400;line-height:1.4;color:var(--o1ig-muted);text-align:left;white-space:nowrap;}
|
||||||
.o1ig-select-option:hover,.o1ig-select-option:focus-visible{outline:none;background:#343538;color:#fff;}
|
.o1ig-resize-warning{display:none;grid-column:2;color:var(--o1ig-muted);font-size:10px;line-height:1.4;}.o1ig-resize-warning.visible{display:block;}
|
||||||
.o1ig-select-option.selected{background:#e7e7e7;color:#151515;font-weight:700;box-shadow:inset 0 1px 0 #fff;}
|
.o1ig-seed{width:100%;height:28px;min-width:0;display:grid;grid-template-columns:minmax(0,1fr) 28px;gap:0;box-sizing:border-box;overflow:hidden;border:1px solid var(--o1ig-border);border-radius:var(--o1ig-radius);background:var(--o1ig-surface);}
|
||||||
.o1ig-select-option.selected:hover,.o1ig-select-option.selected:focus-visible{background:#fff;color:#151515;}
|
.o1ig-seed:hover,.o1ig-seed:focus-within{border-color:var(--o1ig-muted);}
|
||||||
.o1ig-select-option.selected .o1ig-select-option-description{border-color:rgba(0,0,0,.1);background:rgba(0,0,0,.07);color:#343434;}
|
.o1ig-seed .o1ig-control{height:26px;border:0;border-radius:0;background:transparent;}
|
||||||
.o1ig-field{display:flex;flex-direction:column;align-items:stretch;gap:4px;min-width:0;}
|
.o1ig-seed button{height:26px;padding:0;border:0;border-left:1px solid var(--o1ig-border);border-radius:0;font-size:14px;cursor:pointer;}
|
||||||
.o1ig-field label{min-width:0;padding-left:2px;font-size:10px;font-weight:600;line-height:1.3;letter-spacing:.03em;color:#b8bbc5;text-align:left;white-space:nowrap;}
|
.o1ig-mask-wrap{display:grid;grid-template-columns:minmax(0,1fr) 28px;gap:5px;}
|
||||||
.o1ig-resize-warning{display:none;color:#d5aa62;font-size:10px;line-height:1.4;}
|
.o1ig-mask-button{padding:0 9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;cursor:pointer;}.o1ig-mask-clear{padding:0;font-size:15px;cursor:pointer;}
|
||||||
.o1ig-resize-warning.visible{display:block;}
|
.o1ig-generate{width:100%;height:32px;flex:0 0 32px;border-radius:var(--o1ig-radius);font-size:12px;cursor:pointer;}
|
||||||
.o1ig-seed{
|
.o1ig-status{display:none;flex:0 0 14px;min-height:14px;text-align:center;color:var(--o1ig-muted);font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.o1ig-status.visible{display:block;}
|
||||||
width:100%;height:34px;min-width:0;display:grid;grid-template-columns:minmax(0,1fr) 34px;gap:0;
|
|
||||||
box-sizing:border-box;overflow:hidden;border:1px solid rgba(255,255,255,.1);border-radius:7px;
|
|
||||||
background:#1a1b1d;box-shadow:inset 0 1px 0 rgba(255,255,255,.025);
|
|
||||||
}
|
|
||||||
.o1ig-seed:hover,.o1ig-seed:focus-within{border-color:rgba(255,255,255,.22);background:#202123;}
|
|
||||||
.o1ig-seed .o1ig-control{
|
|
||||||
height:32px;border:0;border-radius:0;background:transparent;box-shadow:none;
|
|
||||||
}
|
|
||||||
.o1ig-seed .o1ig-control:hover,.o1ig-seed .o1ig-control:focus{border-color:transparent;background:transparent;}
|
|
||||||
.o1ig-seed button{
|
|
||||||
padding:0;border-left:1px solid rgba(255,255,255,.1);font-size:14px;cursor:pointer;
|
|
||||||
}
|
|
||||||
.o1ig-seed button:hover,.o1ig-seed button:focus{background:rgba(255,255,255,.08);}
|
|
||||||
.o1ig-mask-wrap{display:grid;grid-template-columns:minmax(0,1fr) 32px;gap:5px;}
|
|
||||||
.o1ig-mask-button{padding:0 9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;cursor:pointer;}
|
|
||||||
.o1ig-mask-clear{padding:0;font-size:15px;cursor:pointer;}
|
|
||||||
.o1ig-generate{
|
|
||||||
width:100%;height:42px;flex:0 0 42px;border:1px solid #b9c5ff;border-radius:9px;
|
|
||||||
background:#aab9ff;color:#171c31;font-size:12px;font-weight:700;cursor:pointer;
|
|
||||||
box-shadow:0 4px 14px rgba(78,96,178,.18),inset 0 1px 0 rgba(255,255,255,.35);
|
|
||||||
transition:transform .12s ease,background .12s ease,box-shadow .12s ease;
|
|
||||||
}
|
|
||||||
.o1ig-generate:hover{background:#c3ceff;box-shadow:0 6px 18px rgba(78,96,178,.28),inset 0 1px 0 rgba(255,255,255,.45);}
|
|
||||||
.o1ig-generate:focus-visible{outline:2px solid #e2e7ff;outline-offset:2px;}
|
|
||||||
.o1ig-generate:active{transform:translateY(1px);}
|
|
||||||
.o1ig-status{display:none;flex:0 0 14px;min-height:14px;text-align:center;color:#aaa;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
|
||||||
.o1ig-status.visible{display:block;}.o1ig-status.error{color:#cfcfcf;}
|
|
||||||
.o1igs-progress-host{position:relative;}
|
.o1igs-progress-host{position:relative;}
|
||||||
.o1igs-progress-track{
|
.o1igs-progress-track{
|
||||||
position:absolute;z-index:2;top:1px;left:8px;right:8px;height:2px;border-radius:2px;
|
position:absolute;z-index:2;top:1px;left:8px;right:8px;height:2px;border-radius:2px;
|
||||||
@@ -466,12 +325,12 @@ function isGeneratedSeedControl(widget) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hideBackendWidget(widget) {
|
function hideBackendWidget(widget) {
|
||||||
if (!widget || widget.__o1igHidden) return;
|
if (!widget) return;
|
||||||
|
if (!widget.__o1igHidden) widget.computeSize = () => [0, -4];
|
||||||
widget.__o1igHidden = true;
|
widget.__o1igHidden = true;
|
||||||
widget.hidden = true;
|
widget.hidden = true;
|
||||||
widget.options ??= {};
|
widget.options ??= {};
|
||||||
widget.options.hidden = true;
|
widget.options.hidden = true;
|
||||||
widget.computeSize = () => [0, -4];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideBackendWidgets(node) {
|
function hideBackendWidgets(node) {
|
||||||
@@ -1407,7 +1266,7 @@ function syncGptOutputOptions(node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generatorSaveSettings(node) {
|
function generatorSaveSettings(node) {
|
||||||
const model = node?._o1igModel?.value || findWidget(node, "模型")?.value || "Nano Banana 2";
|
const model = node?._o1igModel?.value || findWidget(node, "模型")?.value || "Nano Banana 2.1";
|
||||||
const capabilities = MODEL_CAPABILITIES[model] || MODEL_CAPABILITIES["Nano Banana 2"];
|
const capabilities = MODEL_CAPABILITIES[model] || MODEL_CAPABILITIES["Nano Banana 2"];
|
||||||
return {
|
return {
|
||||||
filename_prefix: String(
|
filename_prefix: String(
|
||||||
@@ -3950,7 +3809,7 @@ function syncModelOptions(node) {
|
|||||||
}
|
}
|
||||||
const layerDecomposition = isSeedream
|
const layerDecomposition = isSeedream
|
||||||
&& node._o1igLayerDecomposition?.value === "开启";
|
&& node._o1igLayerDecomposition?.value === "开启";
|
||||||
const isNano2 = model === "Nano Banana 2";
|
const isNano2 = model === "Nano Banana 2.1" || model === "Nano Banana 2";
|
||||||
const isNano2Lite = model === "Nano Banana 2 Lite";
|
const isNano2Lite = model === "Nano Banana 2 Lite";
|
||||||
const resolutions = isSeedream
|
const resolutions = isSeedream
|
||||||
? layerDecomposition ? SEEDREAM_LAYER_RESOLUTIONS : SEEDREAM_RESOLUTIONS
|
? layerDecomposition ? SEEDREAM_LAYER_RESOLUTIONS : SEEDREAM_RESOLUTIONS
|
||||||
@@ -4261,7 +4120,7 @@ async function queueGeneration(node, imageCountOverride = null, options = {}) {
|
|||||||
jobPayload.output_format = node._o1igOutputFormat.value;
|
jobPayload.output_format = node._o1igOutputFormat.value;
|
||||||
if (layerDecomposition) jobPayload.layer_decomposition = true;
|
if (layerDecomposition) jobPayload.layer_decomposition = true;
|
||||||
} else if (
|
} else if (
|
||||||
node._o1igModel.value === "Nano Banana 2"
|
["Nano Banana 2.1", "Nano Banana 2"].includes(node._o1igModel.value)
|
||||||
&& node._o1igOnlineSearch.value === "打开"
|
&& node._o1igOnlineSearch.value === "打开"
|
||||||
) {
|
) {
|
||||||
jobPayload.google_search = true;
|
jobPayload.google_search = true;
|
||||||
@@ -4514,7 +4373,7 @@ function buildPanel(node) {
|
|||||||
|
|
||||||
const toolbar = document.createElement("div");
|
const toolbar = document.createElement("div");
|
||||||
toolbar.className = "o1ig-toolbar";
|
toolbar.className = "o1ig-toolbar";
|
||||||
const model = makeSelect(MODEL_OPTIONS, findWidget(node, "模型")?.value || "Nano Banana 2", "模型");
|
const model = makeSelect(MODEL_OPTIONS, findWidget(node, "模型")?.value || "Nano Banana 2.1", "模型");
|
||||||
const resolution = makeSelect(ALL_RESOLUTIONS, findWidget(node, "分辨率")?.value || "智能", "分辨率");
|
const resolution = makeSelect(ALL_RESOLUTIONS, findWidget(node, "分辨率")?.value || "智能", "分辨率");
|
||||||
const ratio = makeSelect(ALL_RATIOS, findWidget(node, "宽高比")?.value || "智能", "宽高比");
|
const ratio = makeSelect(ALL_RATIOS, findWidget(node, "宽高比")?.value || "智能", "宽高比");
|
||||||
const ratioField = makeAdvancedField("宽高比", ratio);
|
const ratioField = makeAdvancedField("宽高比", ratio);
|
||||||
@@ -4862,7 +4721,7 @@ function restorePanelFromWidgets(node) {
|
|||||||
|| String(rawBatchEnabled || "").toLowerCase() === "true"
|
|| String(rawBatchEnabled || "").toLowerCase() === "true"
|
||||||
|| rawBatchEnabled === "开启";
|
|| rawBatchEnabled === "开启";
|
||||||
node._o1igBatchMode.value = findWidget(node, "批量模式")?.value || BATCH_MODE_GROUP_TO_MODELS;
|
node._o1igBatchMode.value = findWidget(node, "批量模式")?.value || BATCH_MODE_GROUP_TO_MODELS;
|
||||||
node._o1igModel.value = findWidget(node, "模型")?.value || "Nano Banana 2";
|
node._o1igModel.value = findWidget(node, "模型")?.value || "Nano Banana 2.1";
|
||||||
node._o1igRoute.value = findWidget(node, "模型线路")?.value || "畅速";
|
node._o1igRoute.value = findWidget(node, "模型线路")?.value || "畅速";
|
||||||
node._o1igThinking.value = findWidget(node, "思考等级")?.value || "低";
|
node._o1igThinking.value = findWidget(node, "思考等级")?.value || "低";
|
||||||
node._o1igOnlineSearch.value = findWidget(node, "在线搜索")?.value || "关闭";
|
node._o1igOnlineSearch.value = findWidget(node, "在线搜索")?.value || "关闭";
|
||||||
@@ -4884,6 +4743,13 @@ function restorePanelFromWidgets(node) {
|
|||||||
syncMaskControl(node);
|
syncMaskControl(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function serializeGeneratorWidgets(node, data) {
|
||||||
|
// LiteGraph stores even serialize:false UI widgets in workflows. Keep only schema widgets.
|
||||||
|
data.widgets_values = (node.widgets || [])
|
||||||
|
.filter(widget => BACKEND_WIDGETS.includes(widget.name) && widget.name !== "内容审查强度")
|
||||||
|
.map(widget => widget.value);
|
||||||
|
}
|
||||||
|
|
||||||
app.registerExtension({
|
app.registerExtension({
|
||||||
name: "o1key.imageGeneratorPanel",
|
name: "o1key.imageGeneratorPanel",
|
||||||
|
|
||||||
@@ -4967,6 +4833,12 @@ app.registerExtension({
|
|||||||
if (nodeData.input?.optional) delete nodeData.input.optional.external_prompt;
|
if (nodeData.input?.optional) delete nodeData.input.optional.external_prompt;
|
||||||
installNativeMinimumSize(nodeType, GENERATOR_MIN_SIZE);
|
installNativeMinimumSize(nodeType, GENERATOR_MIN_SIZE);
|
||||||
|
|
||||||
|
const originalSerialize = nodeType.prototype.onSerialize;
|
||||||
|
nodeType.prototype.onSerialize = function (data) {
|
||||||
|
originalSerialize?.apply(this, arguments);
|
||||||
|
serializeGeneratorWidgets(this, data);
|
||||||
|
};
|
||||||
|
|
||||||
const originalCreated = nodeType.prototype.onNodeCreated;
|
const originalCreated = nodeType.prototype.onNodeCreated;
|
||||||
nodeType.prototype.onNodeCreated = function () {
|
nodeType.prototype.onNodeCreated = function () {
|
||||||
originalCreated?.apply(this, arguments);
|
originalCreated?.apply(this, arguments);
|
||||||
|
|||||||
Reference in New Issue
Block a user