"use client"; import { useEffect, useState } from "react"; import { X, Settings } from "lucide-react"; import { useUserPrefs, type DevicePref } from "@/hooks/useUserPrefs"; export function SettingsButton({ onOpen }: { onOpen: () => void }) { return ( ); } export function SettingsModal({ isOpen, onClose, }: { isOpen: boolean; onClose: () => void; }) { const { prefs, ready, update } = useUserPrefs(); const [tab, setTab] = useState<"general" | "execution" | "device">("general"); const [localPrompt, setLocalPrompt] = useState(""); const [device, setDevice] = useState("auto"); const [gpuIndex, setGpuIndex] = useState(0); const [numGpu, setNumGpu] = useState(1); const [chatLayout, setChatLayout] = useState<"compact" | "edge">("compact"); const [bubbleSize, setBubbleSize] = useState<"sm" | "md" | "lg">("md"); const [sysInfo, setSysInfo] = useState(null); useEffect(() => { if (!ready) return; setLocalPrompt(prefs.systemPrompt); setDevice(prefs.device); setGpuIndex(prefs.gpuIndex); setNumGpu(prefs.numGpu); setChatLayout((prefs as any).chatLayout ?? "compact"); setBubbleSize((prefs as any).bubbleSize ?? "md"); }, [ready, prefs]); const handleSave = () => { update({ systemPrompt: localPrompt, device, gpuIndex, numGpu, chatLayout, bubbleSize }); onClose(); }; if (!isOpen) return null; return (

Settings

{tab === "general" && (