fix(models): route image input by preset capability (#6651)

* fix(providers): preserve images across retries and recovery

Remove destructive text-only retries and validate tool image media at the boundary. Keep image identity across native transport preparation and compaction, and stop incomplete fallback or continuation without replaying tools.

Resolves NAN-442

* fix(models): route image input by preset capability

Replace the expanded image recovery and tool-format changes with an explicit supportsImages preset setting, capability-aware fallback selection, and an Image input switch in model settings. Keep original messages on retry and fail on actual non-transient image errors.

* docs(models): introduce image input settings positively

* test(agent): align image request fixtures with preset routing

Cover successful image requests and direct validation errors when attributing model responses. Configure the image-capability check for the existing text-only provider mocks so governance and override-reuse tests exercise their scripted primary/fallback paths.
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-13 18:16:58 +08:00
1 parent 6a24b17629
commit 3f65a8f86c
36 files changed
+483 -444

No files matched your search

+9 -3
View File
@@ -1784,7 +1784,7 @@ def test_deepseek_vision_preserves_multimodal_content(
@pytest.mark.parametrize("responses", [False, True])
def test_deepseek_pro_remains_text_only(responses: bool) -> None:
def test_deepseek_text_coercion_preserves_image_content(responses: bool) -> None:
provider = OpenAICompatProvider(
api_key="k", default_model="deepseek-v4-pro", spec=find_by_name("deepseek"),
)
@@ -1799,10 +1799,16 @@ def test_deepseek_pro_remains_text_only(responses: bool) -> None:
)
if responses:
assert body["input"] == [{
"role": "user", "content": [{"type": "input_text", "text": "describe the image"}],
"role": "user", "content": [
{"type": "input_text", "text": "describe the image"},
{"type": "input_image", "image_url": "data:image/png;base64,AA==", "detail": "auto"},
],
}]
else:
assert body["messages"] == [{"role": "user", "content": "describe the image"}]
assert body["messages"][0]["content"] == [
{"type": "text", "text": "describe the image"},
{"type": "image_url", "image_url": {"url": "data:image/png;base64,AA=="}},
]
def test_non_deepseek_keeps_list_content() -> None: