This commit is contained in:
Timothy Jaeryang Baek
2026-08-13 00:38:32 -06:00
parent 25802c048e
commit e1acd7e7ca
2 changed files with 18 additions and 13 deletions
+17 -12
View File
@@ -1793,6 +1793,22 @@
const defaultModels = $config?.default_models ? $config?.default_models.split(',') : [];
const openModelSelectorWithSearch = async (modelId: string) => {
const modelSelectorButton = document.getElementById('model-selector-model-button');
modelSelectorButton?.click();
await tick();
const modelSelectorInput = document.getElementById(
'model-search-input'
) as HTMLInputElement | null;
if (modelSelectorInput) {
modelSelectorInput.focus();
modelSelectorInput.value = modelId;
modelSelectorInput.dispatchEvent(new Event('input', { bubbles: true }));
}
};
if ($page.url.searchParams.get('models') || $page.url.searchParams.get('model')) {
const urlModels = (
$page.url.searchParams.get('models') ||
@@ -1803,18 +1819,7 @@
if (urlModels.length === 1) {
if (!$models.find((m) => m.id === urlModels[0])) {
// Model not found; open model selector and prefill
const modelSelectorButton = document.getElementById('model-selector-0-button');
if (modelSelectorButton) {
modelSelectorButton.click();
await tick();
const modelSelectorInput = document.getElementById('model-search-input');
if (modelSelectorInput) {
modelSelectorInput.focus();
modelSelectorInput.value = urlModels[0];
modelSelectorInput.dispatchEvent(new Event('input'));
}
}
await openModelSelectorWithSearch(urlModels[0]);
} else {
// Model found; set it as selected
selectedModels = urlModels;
+1 -1
View File
@@ -338,7 +338,7 @@
} else if (shortcut === Shortcut.OPEN_MODEL_SELECTOR) {
console.log('Shortcut triggered: OPEN_MODEL_SELECTOR');
event.preventDefault();
document.getElementById('model-selector-0-button')?.click();
document.getElementById('model-selector-model-button')?.click();
} else if (shortcut === Shortcut.NEW_TEMPORARY_CHAT) {
console.log('Shortcut triggered: NEW_TEMPORARY_CHAT');
event.preventDefault();