diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 8939ff742..8940b5613 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -475,9 +475,13 @@ selectedModels = $config?.default_models.split(','); } - if (selectedModels.length === 1 && selectedModels[0] === '') { + selectedModels = selectedModels.filter((modelId) => $models.map((m) => m.id).includes(modelId)); + + if (selectedModels.length === 0 || (selectedModels.length === 1 && selectedModels[0] === '')) { if ($models.length > 0) { selectedModels = [$models[0].id]; + } else { + selectedModels = ['']; } }