Add Nano Banana 2.1 and preserve image workflow values

This commit is contained in:
Jony
2026-10-07 13:33:40 +08:00
parent 10a8700589
commit 5212a59047
18 changed files with 480 additions and 295 deletions
+18
View File
@@ -52,6 +52,7 @@ class O1keyImageGeneratorTests(unittest.TestCase):
self.assertEqual(
list(UNIFIED_IMAGE_MODEL_OPTIONS),
[
"Nano Banana 2.1",
"Nano Banana 2",
"Nano Banana Pro",
"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.default, "1")
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.5-sunburst", 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)
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):
raw = (
"status_code=451, The provided prompt is considered unsafe and it "