Agent Zero AI framework
Improve model config provider controls
Alessandroba0d90c3801c
diff --git a/plugins/_model_config/webui/model-field.html b/plugins/_model_config/webui/model-field.htmlindex 89ce9529c..92802edc0 100644--- a/plugins/_model_config/webui/model-field.html+++ b/plugins/_model_config/webui/model-field.html@@ -27,7 +27,8 @@</div><div class="field-control"><select x-model="model.provider"- x-effect="$nextTick(() => { if (providers.length) $el.value = model.provider })">+ x-effect="$nextTick(() => { if (providers.length) $el.value = model.provider })"+ @change="model.api_base = ''"><option value="">— select —</option><template x-for="p in providers" :key="p.value"><option :value="p.value" x-text="p.label"></option>@@ -124,6 +125,22 @@</div></template>+ <!-- Vision support (chat only) -->+ <template x-if="modelType === 'chat'">+ <div class="field">+ <div class="field-label">+ <div class="field-title">Supports Vision</div>+ <div class="field-description">Models capable of Vision can for example natively see the content of image attachments.</div>+ </div>+ <div class="field-control">+ <label class="toggle">+ <input type="checkbox" x-model="model.vision" />+ <span class="toggler"></span>+ </label>+ </div>+ </div>+ </template>+<!-- Advanced Settings (collapsed by default) --><div class="advanced-section" x-data="{ advOpen: false }"><div class="advanced-toggle" @click="advOpen = !advOpen">@@ -158,7 +175,7 @@</div></template>- <!-- Chat-specific: ctx_history, vision, max_embeds -->+ <!-- Chat-specific: ctx_history, max_embeds --><template x-if="modelType === 'chat'"><div><div class="field">@@ -171,18 +188,6 @@<span class="range-value" x-text="model.ctx_history"></span></div></div>- <div class="field">- <div class="field-label">- <div class="field-title">Supports Vision</div>- <div class="field-description">Models capable of Vision can for example natively see the content of image attachments.</div>- </div>- <div class="field-control">- <label class="toggle">- <input type="checkbox" x-model="model.vision" />- <span class="toggler"></span>- </label>- </div>- </div><template x-if="model.vision"><div class="field"><div class="field-label">diff --git a/tests/test_model_config_api_keys.py b/tests/test_model_config_api_keys.pyindex 132618cec..41ba694f9 100644--- a/tests/test_model_config_api_keys.py+++ b/tests/test_model_config_api_keys.py@@ -118,6 +118,30 @@ def test_model_config_frontend_tracks_inline_api_key_edits():assert "$store.modelConfig.resetApiKeyDrafts();" in modal_content+def test_model_config_provider_switch_resets_custom_api_base():+ model_field_path = PROJECT_ROOT / "plugins" / "_model_config" / "webui" / "model-field.html"+ content = model_field_path.read_text(encoding="utf-8")+ select_start = content.index('<select x-model="model.provider"')+ select_end = content.index("</select>", select_start)+ provider_select = content[select_start:select_end]++ assert 'x-model="model.provider"' in provider_select+ assert '@change="model.api_base = \'\'"' in provider_select+++def test_model_config_vision_toggle_is_outside_advanced_settings():+ model_field_path = PROJECT_ROOT / "plugins" / "_model_config" / "webui" / "model-field.html"+ content = model_field_path.read_text(encoding="utf-8")++ vision_start = content.index('<div class="field-title">Supports Vision</div>')+ advanced_start = content.index("<!-- Advanced Settings (collapsed by default) -->")+ max_embeds_start = content.index('<div class="field-title">Max embeds</div>')++ assert content.count('<div class="field-title">Supports Vision</div>') == 1+ assert vision_start < advanced_start+ assert advanced_start < max_embeds_start++def test_ollama_cloud_provider_config_requires_key_and_base_url():import yaml