refactor(agent-modal): revamped UI/UX for the agent modal (#1838)

Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: Dax <mail@thdxr.com>
This commit is contained in:
spoons-and-mirrors
2025-08-12 22:21:57 +02:00
committed by GitHub
parent d16ae1fc4e
commit 81583cddbd
4 changed files with 330 additions and 97 deletions

View File

@@ -599,31 +599,9 @@ func (a Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
a.app.State.UpdateModelUsage(msg.Provider.ID, msg.Model.ID)
cmds = append(cmds, a.app.SaveState())
case app.AgentSelectedMsg:
// Find the agent index
for i, agent := range a.app.Agents {
if agent.Name == msg.Agent.Name {
a.app.AgentIndex = i
break
}
}
a.app.State.Agent = msg.Agent.Name
// Switch to the agent's preferred model if available
if model, ok := a.app.State.AgentModel[msg.Agent.Name]; ok {
for _, provider := range a.app.Providers {
if provider.ID == model.ProviderID {
a.app.Provider = &provider
for _, m := range provider.Models {
if m.ID == model.ModelID {
a.app.Model = &m
break
}
}
break
}
}
}
cmds = append(cmds, a.app.SaveState())
updated, cmd := a.app.SwitchToAgent(msg.AgentName)
a.app = updated
cmds = append(cmds, cmd)
case dialog.ThemeSelectedMsg:
a.app.State.Theme = msg.ThemeName
cmds = append(cmds, a.app.SaveState())
@@ -1171,6 +1149,7 @@ func (a Model) executeCommand(command commands.Command) (tea.Model, tea.Cmd) {
case commands.ModelListCommand:
modelDialog := dialog.NewModelDialog(a.app)
a.modal = modelDialog
case commands.AgentListCommand:
agentDialog := dialog.NewAgentDialog(a.app)
a.modal = agentDialog