Agent Zero AI framework
Model Switcher UI improvements: highlight color, notification removal, preset display & validation
keyboardstaff5acdd4d30258
diff --git a/plugins/_model_config/extensions/webui/chat-input-start/model-switcher.html b/plugins/_model_config/extensions/webui/chat-input-start/model-switcher.htmlindex 6cc3cc682..1eb8e1e54 100644--- a/plugins/_model_config/extensions/webui/chat-input-start/model-switcher.html+++ b/plugins/_model_config/extensions/webui/chat-input-start/model-switcher.html@@ -28,7 +28,6 @@<template x-if="$store.modelConfig.switcherOverride"><div class="model-switcher-item revert" @click="$store.modelConfig.clearOverrideSwitch($store.chats?.selected || '');- justToast('Reverted to default model', 'info');showDropdown = false;"><span class="material-symbols-outlined" style="font-size: 15px;">undo</span>@@ -48,12 +47,31 @@:class="{ 'active': $store.modelConfig.switcherOverride?.preset_name === preset.name }"@click="$store.modelConfig.selectPresetSwitch($store.chats?.selected || '', preset.name);- justToast('Switched to ' + preset.name, 'success');showDropdown = false;"><div class="model-switcher-preset-name" x-text="preset.name"></div>- <div class="model-switcher-preset-detail"- x-text="$store.modelConfig.getPresetSummary(preset)"></div>+ <div class="model-switcher-preset-models">+ <template x-if="preset.chat?.name">+ <div class="model-switcher-model-row">+ <span class="model-switcher-model-label">Main</span>+ <span class="model-switcher-model-value">+ <span x-text="preset.chat.provider" style="opacity:0.5;"></span>+ <span style="opacity:0.3; margin:0 3px;">/</span>+ <span x-text="preset.chat.name"></span>+ </span>+ </div>+ </template>+ <template x-if="preset.utility?.name">+ <div class="model-switcher-model-row">+ <span class="model-switcher-model-label">Utility</span>+ <span class="model-switcher-model-value">+ <span x-text="preset.utility.provider" style="opacity:0.5;"></span>+ <span style="opacity:0.3; margin:0 3px;">/</span>+ <span x-text="preset.utility.name"></span>+ </span>+ </div>+ </template>+ </div></div></template></div>@@ -95,8 +113,8 @@color: var(--color-text-secondary, #666);}.model-switcher-btn.has-override {- border-color: var(--color-accent, #4a9eff);- color: var(--color-accent, #4a9eff);+ border-color: var(--color-highlight);+ color: var(--color-highlight);}.model-switcher-label {max-width: 160px;@@ -128,8 +146,7 @@background: var(--color-background-hover, rgba(255,255,255,0.06));}.model-switcher-item.active {- background: var(--color-accent-bg, rgba(74, 158, 255, 0.12));- color: var(--color-accent, #4a9eff);+ background: color-mix(in srgb, var(--color-highlight) 12%, transparent);}.model-switcher-item.revert {display: flex;@@ -153,9 +170,30 @@.model-switcher-preset-name {font-weight: 500;}- .model-switcher-preset-detail {+ .model-switcher-preset-models {+ display: flex;+ flex-direction: column;+ gap: 2px;+ margin-top: 4px;+ }+ .model-switcher-model-row {+ display: flex;+ align-items: center;+ gap: 6px;font-size: 0.7rem;- opacity: 0.6;- margin-top: 1px;+ opacity: 0.7;+ }+ .model-switcher-model-label {+ width: 40px;+ flex-shrink: 0;+ font-weight: 500;+ opacity: 0.7;+ }+ .model-switcher-model-value {+ flex: 1;+ min-width: 0;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;}</style>diff --git a/plugins/_model_config/webui/config.html b/plugins/_model_config/webui/config.htmlindex e31fd8114..c831f0015 100644--- a/plugins/_model_config/webui/config.html+++ b/plugins/_model_config/webui/config.html@@ -50,7 +50,7 @@<span class="preset-card-summary" x-show="!expanded"x-text="(preset.chat?.provider ? preset.chat.provider + '/' : '') + (preset.chat?.name || '')"></span><button class="text-button preset-delete-btn"- @click.stop="config.model_presets = config.model_presets.filter((_, i) => i !== idx)"+ @click.stop="$confirmClick($event, () => { config.model_presets = config.model_presets.filter((_, i) => i !== idx) })"title="Remove preset"><span class="material-symbols-outlined" style="font-size:16px;">close</span></button>@@ -62,7 +62,8 @@<div class="field-title">Preset name</div><div class="field-description">Display name shown in the model switcher dropdown.</div></div>- <div class="field-control"><input type="text" x-model="preset.name" placeholder="e.g. GPT-4o, Claude Sonnet" /></div>+ <div class="field-control"><input type="text" x-model="preset.name" placeholder="e.g. GPT-4o, Claude Sonnet"+ @blur="if (!preset.name.trim()) preset.name = 'Preset ' + (idx + 1)" required /></div></div><div class="preset-subheader">Main Model</div>@@ -221,7 +222,7 @@@click="if (!config.model_presets) config.model_presets = [];config.model_presets = [...config.model_presets, {- name: '',+ name: 'Preset ' + (config.model_presets.length + 1),chat: { provider: config.chat_model.provider || '', name: config.chat_model.name || '', api_key: '', api_base: config.chat_model.api_base || '' },utility: { provider: '', name: '', api_key: '', api_base: '' }}]">diff --git a/plugins/_model_config/webui/model-config-store.js b/plugins/_model_config/webui/model-config-store.jsindex 46810d63d..bd1be368e 100644--- a/plugins/_model_config/webui/model-config-store.js+++ b/plugins/_model_config/webui/model-config-store.js@@ -175,7 +175,7 @@ export const store = createStore("modelConfig", {const cfgData = await this._fetchConfigData();const chatCfg = cfgData.config?.chat_model || {};result.allowed = !!chatCfg.allow_chat_override;- result.presets = cfgData.config?.model_presets || [];+ result.presets = (cfgData.config?.model_presets || []).filter(p => p.name);if (!result.allowed) return result;if (contextId) {const overRes = await fetchApi(`${API_BASE}/model_override`, {