resolve issue #1070
Motivation
https://github.com/exo-explore/exo/issues/1070
Changes
Added check in ChatForm.svelte to reset selectedChatModel when it no longer matches any running instance.
Why It Works
The $effect now detects when the selected model is stale (not in availableModels()) and resets to the first available model.
Test Plan
Manual Testing
- Create instance of Model A → Delete it → Create instance of Model B → Chat
- Verify request goes to Model B (not Model A)
I think the better way to fix this is to auto-select an instance after launching it.
If we delete one that is selected, then we should select the most recently launched model.
Most importantly, whatever is selected in the dropdown menu should be the one that we chat to, otherwise what we display to the user is not in line with the actual model running.
Tested this change.
Launching an instance does not select it in the model dropdown.
How to reproduce:
- Launch an instance of Qwen 0.6B 4-bit
- It gets auto-selected (correct)
- Chat with Qwen 0.6B 4-bit
- It returns correctly using Qwen 0.6B 4-bit (correct)
- Launch an instance of Llama 1B 4-bit
- It does not select Llama 1B 4-bit (wrong)
- Launch an instance of Qwen 0.6B 4-bit
- It gets auto-selected (correct)
- Chat with Qwen 0.6B 4-bit
- It returns correctly using Qwen 0.6B 4-bit (correct)
- Delete instance of Qwen 0.6B 4-bit
- Instance gets deleted and model option disappears next to chat input
- Chat again
- Response is
Error: API error: 404 - {"detail":"No instance found for model mlx-community/Qwen3-0.6B-4bit"}(WRONG)
The correct behavior should be when you start exo from scratch with no instances and try to chat - it returns Error: No model selected and no running instances available. Please launch an instance first.
So the solution is when there are no instances it should behave like when you open the dashboard initially and no instances have been launched.
Added an else branch to clear the selection when no instances are running @AlexCheema