按 OpenAI 官方放开 GIF+参考图,SVG 仍仅文生图;有蒙版禁用 GIF/SVG

This commit is contained in:
Jony
2026-11-09 11:41:31 +08:00
parent 81a0e50b2d
commit 7d6e7fa5d8
12 changed files with 190 additions and 31 deletions
+33 -6
View File
@@ -467,14 +467,41 @@ class GPTImage26SvgGifTests(unittest.TestCase):
def test_svg_gif_reject_edit_inputs(self):
import torch
from comfyui_o1key.utils.o1key_image_catalog import validate_gpt_image_vector_output
client = object.__new__(GptImageClient)
fake = torch.zeros((1, 8, 8, 3))
for output_format in ("svg", "gif"):
with self.assertRaisesRegex(ValueError, "纯文生图"):
client._build_async_generate_body(
"test", "gpt-image-2.6-sunburst", "high", None, 1,
image_list=[fake], output_format=output_format,
)
with self.assertRaisesRegex(ValueError, "纯文生图"):
client._build_async_generate_body(
"test", "gpt-image-2.6-sunburst", "high", None, 1,
image_list=[fake], output_format="svg",
)
# GIF + reference images is allowed (OpenAI image edit guidance).
validate_gpt_image_vector_output(
"gpt-image-2.6-sunburst",
"gif",
has_images=True,
has_mask=False,
)
with self.assertRaisesRegex(ValueError, "纯文生图"):
validate_gpt_image_vector_output(
"gpt-image-2.6-sunburst",
"svg",
has_images=False,
has_mask=True,
)
with self.assertRaisesRegex(ValueError, "不支持蒙版"):
validate_gpt_image_vector_output(
"gpt-image-2.6-sunburst",
"gif",
has_images=True,
has_mask=True,
)
with self.assertRaisesRegex(ValueError, "不支持蒙版"):
client._build_async_generate_body(
"test", "gpt-image-2.6-sunburst", "high", None, 1,
image_list=[fake], mask_tensor=fake, output_format="gif",
)
def test_materialize_gif_expands_frames_and_keeps_bytes(self):
from io import BytesIO