/** * Settings dialog with sidebar-style nav (Appearance, AI). Reference: shadcn sidebar-13. */ import React, { useCallback, useState } from 'react' import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, } from '@/components/ui/dialog' import { Button } from '@/components/ui/button' import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '@/components/ui/select' import { Switch } from '@/components/ui/switch' import { Input } from '@/components/ui/input' import { useTheme } from '@/lib/themeContext' import type { Theme } from '@/lib/themeContext' import { usePlatform } from './KosmosContext' import type { AiConnection, AiConnectionProvider } from './KosmosContext' import { Sun, Sparkles } from 'lucide-react' type SettingsSection = 'appearance' | 'ai' export function SettingsDialog({ trigger, }: { trigger: React.ReactNode }) { const [open, setOpen] = useState(false) const [section, setSection] = useState('appearance') const { theme, setTheme } = useTheme() const { showMinimap, setShowMinimap, aiConnection, setAiConnection } = usePlatform() const updateAiConnection = useCallback( (partial: Partial) => { setAiConnection({ ...aiConnection, ...partial }) }, [aiConnection, setAiConnection] ) return ( {trigger} Settings
{section === 'appearance' && (

Appearance

Canvas

)} {section === 'ai' && (

AI connection

Used by the Agent node. Choose OpenAI or a local server (e.g. LM Studio).

{aiConnection.provider === 'local' && (
updateAiConnection({ baseURL: e.target.value })} className="font-mono text-xs" />
)}
updateAiConnection({ model: e.target.value })} className="font-mono text-xs" />
updateAiConnection({ apiKey: e.target.value })} className="font-mono text-xs" />
)}
) }