fix: handle image_url rejection by retrying without images

Replace the static provider-level supports_vision check with a
reactive fallback: when a model returns an image-unsupported error,
strip image_url blocks from messages and retry once. This avoids
maintaining an inaccurate vision capability table and correctly
handles gateway/unknown model scenarios.

Also extract _safe_chat() to deduplicate try/except boilerplate
in chat_with_retry().
This commit is contained in:
Xubin Ren
2026-03-15 22:32:34 +08:00
committed by Xubin Ren
parent de0b5b3d91
commit c4628038c6
4 changed files with 142 additions and 72 deletions
-3
View File
@@ -61,9 +61,6 @@ class ProviderSpec:
# Provider supports cache_control on content blocks (e.g. Anthropic prompt caching)
supports_prompt_caching: bool = False
# Provider supports vision/image inputs (most modern models do)
supports_vision: bool = True
@property
def label(self) -> str:
return self.display_name or self.name.title()