"use client"; import { useState } from "react"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@kandev/ui/select"; import { Separator } from "@kandev/ui/separator"; import { useAppStore, useAppStoreApi } from "@/components/state-provider"; import { useToast } from "@/components/toast-provider"; import { updateWorkspaceAction } from "@/app/actions/workspaces"; export function ConfigChatAgentSection() { const workspace = useAppStore( (s) => s.workspaces.items.find((w) => w.id === s.workspaces.activeId) ?? null, ); const profiles = useAppStore((s) => s.agentProfiles.items ?? []); const currentProfileId = workspace?.default_config_agent_profile_id ?? ""; const [saving, setSaving] = useState(false); const { toast } = useToast(); const storeApi = useAppStoreApi(); const handleChange = async (value: string) => { const effectiveValue = value === "none" ? "" : value; if (!workspace) return; setSaving(true); try { await updateWorkspaceAction(workspace.id, { default_config_agent_profile_id: effectiveValue, }); const { workspaces, setWorkspaces } = storeApi.getState(); setWorkspaces( workspaces.items.map((w) => w.id === workspace.id ? { ...w, default_config_agent_profile_id: effectiveValue } : w, ), ); toast({ title: "Configuration agent updated", variant: "success" }); } catch (error) { toast({ title: "Failed to update", description: error instanceof Error ? error.message : "Unknown error", variant: "error", }); } finally { setSaving(false); } }; if (!workspace) return null; return (

Configuration Chat Agent

Choose which agent profile to use for the Configuration Chat. This agent can manage your workflows, agent profiles, and MCP configuration.

); }