feat(settings): add default model and agent settings with UI integration

This commit is contained in:
Bohdan Triapitsyn
2025-12-26 04:38:38 +02:00
parent c0c82663c0
commit 48f1e3ef0f
9 changed files with 429 additions and 38 deletions
+14 -4
View File
@@ -126,10 +126,20 @@ export const useSessionStore = create<SessionStore>()(
try {
const configState = useConfigStore.getState();
const visibleAgents = configState.getVisibleAgents();
const agentName =
configState.currentAgentName ||
visibleAgents.find((agent) => agent.name === 'build')?.name ||
visibleAgents[0]?.name;
// Priority: settingsDefaultAgent → build → first visible
let agentName: string | undefined;
if (configState.settingsDefaultAgent) {
const settingsAgent = visibleAgents.find((a) => a.name === configState.settingsDefaultAgent);
if (settingsAgent) {
agentName = settingsAgent.name;
}
}
if (!agentName) {
agentName =
visibleAgents.find((agent) => agent.name === 'build')?.name ||
visibleAgents[0]?.name;
}
if (agentName) {
configState.setAgent(agentName);