From 7152a06d23bec6480b35a2de4482f9cc4f4f359d Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 6 Jul 2026 14:41:50 -0700 Subject: [PATCH] refactor: Check vision support against active model Co-authored-by: cecli (openai/gemini_cli/gemini-2.5-pro) --- cecli/commands/add.py | 5 +++-- cecli/commands/read_only.py | 5 +++-- cecli/commands/read_only_stub.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cecli/commands/add.py b/cecli/commands/add.py index c4a4e31d15b..98291353488 100644 --- a/cecli/commands/add.py +++ b/cecli/commands/add.py @@ -125,10 +125,11 @@ async def execute(cls, io, coder, args, **kwargs): else: io.tool_error(f"Cannot add {matched_file} as it's not part of the repository") else: - if is_image_file(matched_file) and not coder.main_model.info.get("supports_vision"): + active_model = coder.get_active_model() + if is_image_file(matched_file) and not active_model.info.get("supports_vision"): io.tool_error( f"Cannot add image file {matched_file} as the" - f" {coder.main_model.name} does not support images." + f" {active_model.name} does not support images." ) continue content = io.read_text(abs_file_path) diff --git a/cecli/commands/read_only.py b/cecli/commands/read_only.py index b5f5b4d98d9..ff5f8cad6e6 100644 --- a/cecli/commands/read_only.py +++ b/cecli/commands/read_only.py @@ -156,10 +156,11 @@ def _add_read_only_file( source_mode="read-only", target_mode="read-only", ): - if is_image_file(original_name) and not coder.main_model.info.get("supports_vision"): + active_model = coder.get_active_model() + if is_image_file(original_name) and not active_model.info.get("supports_vision"): io.tool_error( f"Cannot add image file {original_name} as the" - f" {coder.main_model.name} does not support images." + f" {active_model.name} does not support images." ) return diff --git a/cecli/commands/read_only_stub.py b/cecli/commands/read_only_stub.py index c75ff9b6628..240fd8a25c9 100644 --- a/cecli/commands/read_only_stub.py +++ b/cecli/commands/read_only_stub.py @@ -156,10 +156,11 @@ def _add_read_only_file( source_mode="read-only", target_mode="read-only", ): - if is_image_file(original_name) and not coder.main_model.info.get("supports_vision"): + active_model = coder.get_active_model() + if is_image_file(original_name) and not active_model.info.get("supports_vision"): io.tool_error( f"Cannot add image file {original_name} as the" - f" {coder.main_model.name} does not support images." + f" {active_model.name} does not support images." ) return