From e6587a8d8e374dd36624ce8ab3fc9a3d9f45daf0 Mon Sep 17 00:00:00 2001 From: Haisam Abbas Date: Wed, 20 May 2026 12:18:18 +0500 Subject: [PATCH] Fix image mime detection for MiniMax --- tests/providers/test_image_generation.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/providers/test_image_generation.py b/tests/providers/test_image_generation.py index 3bee376d8..eea3a3fe6 100644 --- a/tests/providers/test_image_generation.py +++ b/tests/providers/test_image_generation.py @@ -390,6 +390,17 @@ async def test_minimax_payload_and_response_with_reference_image(tmp_path: Path) assert body["subject_reference"][0]["image_file"].startswith("data:image/png;base64,") +@pytest.mark.asyncio +async def test_minimax_base64_response_uses_detected_mime() -> None: + raw_b64 = base64.b64encode(JPEG_BYTES).decode("ascii") + fake = FakeClient(FakeResponse({"data": {"image_base64": [raw_b64]}})) + client = MiniMaxImageGenerationClient(api_key="sk-mm-test", client=fake) # type: ignore[arg-type] + + response = await client.generate(prompt="draw", model="image-01") + + assert response.images == [f"data:image/jpeg;base64,{raw_b64}"] + + # --------------------------------------------------------------------------- # StepFun (阶跃星辰) # ---------------------------------------------------------------------------