fix: replace free-text model input with select dropdown in agent creation#17
fix: replace free-text model input with select dropdown in agent creation#17
Conversation
…tion Fetches available models from /ai/providers/known API and renders them as a Select dropdown instead of a free-text Input field.
There was a problem hiding this comment.
Pull request overview
Updates the Create Agent dialog to use a dropdown for selecting a default model, populated from the server’s known AI providers list.
Changes:
- Fetches known providers/models from
/ai/providers/knownon page load and stores available model IDs in local state. - Replaces the free-text “Default Model” input with a
Selectdropdown that lists the fetched models.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /> | ||
| onValueChange={(value) => setNewAgent({ ...newAgent, model: value })} | ||
| > | ||
| <SelectTrigger> |
There was a problem hiding this comment.
Label uses htmlFor="model", but the Select control no longer has a matching id, so the label isn’t associated with the interactive element (hurts accessibility / click-to-focus). Add id="model" to the SelectTrigger (or otherwise wire the label to the trigger via aria-labelledby).
| <SelectTrigger> | |
| <SelectTrigger id="model"> |
| /> | ||
| onValueChange={(value) => setNewAgent({ ...newAgent, model: value })} | ||
| > | ||
| <SelectTrigger> |
There was a problem hiding this comment.
SelectTrigger defaults to w-fit in the shared UI component, so this dropdown will likely render narrower than the other form controls (Input is w-full) and look misaligned in the dialog. Consider passing className="w-full" to SelectTrigger (and/or SelectContent) so the model picker matches the width of the other fields.
| <SelectTrigger> | |
| <SelectTrigger className="w-full"> |
| const fetchModels = async () => { | ||
| const data = await api.getKnownProviders(); | ||
| const models = data.providers.flatMap((p) => p.models); | ||
| setAvailableModels(models); |
There was a problem hiding this comment.
PR description says models are grouped by provider, but the implementation flattens all provider model lists into a single array (flatMap) and renders a single ungrouped list. Either update the PR description, or keep provider context (e.g., store providers in state and render SelectGroup/SelectLabel per provider).
Summary
/ai/providers/knownAPI on page loadTest plan