remove top bar model selector

This commit is contained in:
Daniel 2026-05-08 08:28:54 +02:00
parent 6da5565f89
commit db2ecca45d
3 changed files with 11 additions and 22 deletions

View file

@ -172,11 +172,6 @@
</div>
</div>
<div class="header-right">
<div class="model-selector">
<label><i class="fas fa-robot"></i></label>
<select id="global-model-select"></select>
<span id="model-cost-badge" class="cost-badge" style="display:none;"></span>
</div>
<div class="header-buttons">
<button id="btn-settings" class="btn-header" title="Settings">
<i class="fas fa-cog"></i>

View file

@ -182,9 +182,7 @@ document.addEventListener('DOMContentLoaded', function() {
}
});
// --- MODEL SELECTOR ---
var modelSelect = document.getElementById('global-model-select');
var costBadge = document.getElementById('model-cost-badge');
// --- MODEL SELECTORS ---
window._currentModels = [];
window._currentProvider = 'openrouter';
window._defaultModelId = '';
@ -216,11 +214,6 @@ document.addEventListener('DOMContentLoaded', function() {
var defaultModelId = data.defaultModel || (window._currentModels.length > 0 ? window._currentModels[0].id : '');
window._defaultModelId = defaultModelId;
if (modelSelect && window._currentModels.length > 0) {
window._buildModelOptions(modelSelect);
if (costBadge) costBadge.textContent = '';
}
// Populate all per-tab model selectors already in DOM
document.querySelectorAll('.tab-model-select').forEach(function(sel) {
window._buildModelOptions(sel);
@ -228,13 +221,6 @@ document.addEventListener('DOMContentLoaded', function() {
})
.catch(function(err) { console.warn('Models load failed:', err); });
if (modelSelect) {
modelSelect.addEventListener('change', function() {
var m = window._currentModels.find(function(x) { return x.id === modelSelect.value; });
showToast('Model: ' + modelSelect.value.split('/').pop(), 'info');
});
}
console.log('✅ App.js DOM ready');
}); // end DOMContentLoaded
@ -331,8 +317,7 @@ function getSelectedModel() {
var tabSel = activeTab.querySelector('.tab-model-select');
if (tabSel && tabSel.value) return tabSel.value;
}
var sel = document.getElementById('global-model-select');
return sel ? sel.value : 'google/gemini-2.5-flash';
return undefined;
}
function showLoading(text) {

View file

@ -18,11 +18,20 @@ test('api models endpoint preserves saved default in model list', () => {
test('lazy-loaded tab model selectors apply admin default', () => {
const app = read('public/js/app.js');
const index = read('public/index.html');
assert.match(app, /window\._defaultModelId = ''/);
assert.match(app, /window\._defaultModelId = defaultModelId/);
assert.match(app, /window\._buildModelOptions\(sel\)/);
assert.match(app, /selectEl\.value = window\._defaultModelId/);
assert.match(app, /saved\.textContent = window\._defaultModelId \+ ' \(saved default\)'/);
assert.doesNotMatch(index, /global-model-select|model-cost-badge/);
});
test('top bar model selector is removed and omitted selections use backend default', () => {
const app = read('public/js/app.js');
const selector = app.match(/function getSelectedModel\(\) \{[\s\S]*?\n\}/)[0];
assert.doesNotMatch(selector, /global-model-select|gemini-2\.5-flash/);
assert.match(selector, /return undefined/);
});
test('backend AI calls use admin default when request omits model', () => {