import { useState } from "react"; import { useTheme } from "../contexts/ThemeContext"; import { ProviderSettingsGrid } from "@/components/ProviderSettings"; import ConfirmationDialog from "@/components/ConfirmationDialog"; import { IpcClient } from "@/ipc/ipc_client"; import { showSuccess, showError } from "@/lib/toast"; import { AutoApproveSwitch } from "@/components/AutoApproveSwitch"; import { TelemetrySwitch } from "@/components/TelemetrySwitch"; import { MaxChatTurnsSelector } from "@/components/MaxChatTurnsSelector"; import { ThinkingBudgetSelector } from "@/components/ThinkingBudgetSelector"; import { useSettings } from "@/hooks/useSettings"; import { useAppVersion } from "@/hooks/useAppVersion"; import { Button } from "@/components/ui/button"; import { ArrowLeft } from "lucide-react"; import { useRouter } from "@tanstack/react-router"; import { GitHubIntegration } from "@/components/GitHubIntegration"; import { SupabaseIntegration } from "@/components/SupabaseIntegration"; import { Switch } from "@/components/ui/switch"; import { Label } from "@/components/ui/label"; export default function SettingsPage() { const { theme, setTheme } = useTheme(); const [isResetDialogOpen, setIsResetDialogOpen] = useState(false); const [isResetting, setIsResetting] = useState(false); const appVersion = useAppVersion(); const { settings, updateSettings } = useSettings(); const router = useRouter(); const handleResetEverything = async () => { setIsResetting(true); try { const ipcClient = IpcClient.getInstance(); await ipcClient.resetAll(); showSuccess("Successfully reset everything. Restart the application."); } catch (error) { console.error("Error resetting:", error); showError( error instanceof Error ? error.message : "An unknown error occurred", ); } finally { setIsResetting(false); setIsResetDialogOpen(false); } }; return (

Settings

{/* App Version Section */}
App Version: {appVersion ? appVersion : "-"}

General Settings

{(["system", "light", "dark"] as const).map((option) => ( ))}
This will automatically approve code changes and run them.
{ updateSettings({ enableNativeGit: checked, }); }} />

Telemetry

This records anonymous usage data to improve the product.
Telemetry ID: {settings ? settings.telemetryUserId : "n/a"}
{/* Integrations Section */}

Integrations

{/* Experiments Section */}

Experiments

{/* Enable File Editing Experiment */}
{ updateSettings({ experiments: { ...settings?.experiments, enableFileEditing: checked, }, }); }} />

File editing is not reliable and requires you to manually commit changes and update Supabase edge functions.

{/* Danger Zone */}

Danger Zone

Reset Everything

This will delete all your apps, chats, and settings. This action cannot be undone.

setIsResetDialogOpen(false)} />
); }