feat: per-CLI model picker for local agents (closes #8)

Each agent CLI declares its selectable models (and reasoning effort, for
Codex) on the daemon side; the frontend renders a model dropdown in the
avatar menu and the Settings dialog scoped to the currently picked CLI,
persists the choice per-agent in the AppConfig, and threads it through
/api/chat to the spawn argv. "Default" leaves the flag off so the CLI's
own config wins.
This commit is contained in:
pftom
2026-04-28 22:54:18 +08:00
parent 94941f59a9
commit f2d28a1cca
13 changed files with 414 additions and 25 deletions
+13
View File
@@ -137,6 +137,18 @@ export function App() {
[config],
);
const handleAgentModelChange = useCallback(
(agentId: string, choice: { model?: string; reasoning?: string }) => {
const prev = config.agentModels?.[agentId] ?? {};
const merged = { ...prev, ...choice };
const nextAgentModels = { ...(config.agentModels ?? {}), [agentId]: merged };
const next = { ...config, agentModels: nextAgentModels };
saveConfig(next);
setConfig(next);
},
[config],
);
const handleChangeDefaultDesignSystem = useCallback(
(designSystemId: string) => {
const next = { ...config, designSystemId };
@@ -272,6 +284,7 @@ export function App() {
daemonLive={daemonLive}
onModeChange={handleModeChange}
onAgentChange={handleAgentChange}
onAgentModelChange={handleAgentModelChange}
onRefreshAgents={refreshAgents}
onOpenSettings={openSettings}
onBack={handleBack}