Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions static/js/modelPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { providerLogo } from './providers.js';
import uiModule from './ui.js';
import settingsModule from './settings.js';
import { sortModelObjects } from './modelSort.js';
import { topPortalZ } from './toolWindowZOrder.js';

const API_BASE = window.location.origin;

Expand Down Expand Up @@ -182,6 +183,24 @@ function _initModelPickerDropdown() {
const refreshBtn = document.getElementById('model-picker-refresh-btn');
if (!wrap || !btn || !menu || !search || !listEl) return;

function _liftInputBar() {
wrap.style.setProperty('z-index', String(topPortalZ()), 'important');
const bar = document.querySelector('.chat-input-bar');
if (bar) {
bar.style.setProperty('position', 'relative', 'important');
bar.style.setProperty('z-index', String(topPortalZ()), 'important');
}
}

function _restoreInputBar() {
wrap.style.removeProperty('z-index');
const bar = document.querySelector('.chat-input-bar');
if (bar) {
bar.style.removeProperty('position');
bar.style.removeProperty('z-index');
}
}

function _close() {
if (menu.classList.contains('hidden')) return;
// Restore scroll button
Expand All @@ -193,13 +212,15 @@ function _initModelPickerDropdown() {
menu.classList.remove('closing');
menu.classList.add('hidden');
search.value = '';
_restoreInputBar();
}, { once: true });
// Fallback if animationend doesn't fire
setTimeout(() => {
if (!menu.classList.contains('hidden')) {
menu.classList.remove('closing');
menu.classList.add('hidden');
search.value = '';
_restoreInputBar();
}
}, 200);
}
Expand Down Expand Up @@ -655,6 +676,7 @@ function _initModelPickerDropdown() {
if (menu.classList.contains('hidden') || menu.classList.contains('closing')) {
// Force-clear any in-progress close animation
menu.classList.remove('closing', 'hidden');
_liftInputBar();
_populate('');
if (window.modelsModule && window.modelsModule.refreshModels) {
window.modelsModule.refreshModels().then(() => {
Expand Down