Skip to content

fix: replace free-text model input with select dropdown in agent creation#17

Merged
hoootan merged 1 commit intomainfrom
fix/agent-model-select
Apr 11, 2026
Merged

fix: replace free-text model input with select dropdown in agent creation#17
hoootan merged 1 commit intomainfrom
fix/agent-model-select

Conversation

@hoootan
Copy link
Copy Markdown
Owner

@hoootan hoootan commented Apr 11, 2026

Summary

  • Replace free-text Input with Select dropdown for Default Model in Create Agent dialog
  • Fetches available models from /ai/providers/known API on page load
  • Models grouped from all configured providers (Anthropic, OpenAI, Google, etc.)

Test plan

  • Open Agents page → Create Agent dialog → verify model dropdown shows configured models
  • Select a model and create agent → verify it saves correctly

…tion

Fetches available models from /ai/providers/known API and renders
them as a Select dropdown instead of a free-text Input field.
Copilot AI review requested due to automatic review settings April 11, 2026 18:01
@hoootan hoootan merged commit 90b6179 into main Apr 11, 2026
5 checks passed
@hoootan hoootan deleted the fix/agent-model-select branch April 11, 2026 18:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/known on page load and stores available model IDs in local state.
  • Replaces the free-text “Default Model” input with a Select dropdown 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>
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
<SelectTrigger>
<SelectTrigger id="model">

Copilot uses AI. Check for mistakes.
/>
onValueChange={(value) => setNewAgent({ ...newAgent, model: value })}
>
<SelectTrigger>
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
<SelectTrigger>
<SelectTrigger className="w-full">

Copilot uses AI. Check for mistakes.
Comment on lines +63 to +66
const fetchModels = async () => {
const data = await api.getKnownProviders();
const models = data.providers.flatMap((p) => p.models);
setAvailableModels(models);
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants