feat: GPT Image 节点新增质量参数、批量提示词及模型调整

- 新增「质量」下拉参数(高/中/低/自动),默认 auto,两个接口均传递 quality 字段
- 支持批量提示词模式:prompt 中用单独一行 --- 分隔多条提示词,逐条调用 API 并合并输出
- 模型列表更新:移除 gpt-image-1 / gpt-image-1-特价,新增 gpt-image-2,默认改为 gpt-image-2
- size 字段始终传递(auto 也上传),移除 seed 参数传递

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
This commit is contained in:
o1key
2026-04-22 14:59:43 +08:00
co-authored by Claude Sonnet 4.5
parent afa732b93a
commit 949f7bb180
2 changed files with 87 additions and 47 deletions
+7 -14
View File
@@ -33,7 +33,6 @@ _ENDPOINT_EDITS = "/v1/images/edits/"
# ── 模型名映射(UI 显示名 → API 实际参数名)─────────────────────────────────
_MODEL_NAME_MAP = {
"gpt-image-1-特价": "gpt-image-1-special",
"gpt-image-1.5-特价": "gpt-image-1.5-special",
"gpt-image-2-特价": "gpt-image-2-special",
}
@@ -215,13 +214,7 @@ class GptImageClient:
"moderation": "low",
}
# size = "auto" 时不传该字段,让 API 自行决定
if size and size != "auto":
body["size"] = size
# seed > 0 时才传递(0 视为不指定)
if seed > 0:
body["seed"] = seed
body["size"] = size if size else "auto"
# 图生图:将 tensor 转成 data URI 内联
if image_tensor is not None:
@@ -298,15 +291,15 @@ class GptImageClient:
image_tensor = image_tensor.unsqueeze(0) # [H,W,C] → [1,H,W,C]
num_images = image_tensor.shape[0]
# o1key 中转服务的 edits 接口暂不支持 quality / background / moderation / seed
# o1key 中转服务的 edits 接口暂不支持 background / moderation / seed
# 待服务方更新后可重新加入。
form = aiohttp.FormData()
form.add_field("model", api_model)
form.add_field("prompt", prompt)
form.add_field("n", str(n))
form.add_field("model", api_model)
form.add_field("prompt", prompt)
form.add_field("n", str(n))
form.add_field("quality", quality)
if size and size != "auto":
form.add_field("size", size)
form.add_field("size", size if size else "auto")
# 多图:用 image[] 数组字段逐张附加,支持 gpt-image-1.5 最多 16 张
for i in range(num_images):