import { Button } from "@/components/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { Switch } from "@/components/ui/switch"; import { Label } from "@/components/ui/label"; import { Sparkles, Info } from "lucide-react"; import { useSettings } from "@/hooks/useSettings"; import { IpcClient } from "@/ipc/ipc_client"; import { hasDyadProKey, type UserSettings } from "@/lib/schemas"; export function ProModeSelector() { const { settings, updateSettings } = useSettings(); const toggleWebSearch = () => { updateSettings({ enableProWebSearch: !settings?.enableProWebSearch, }); }; const handleTurboEditsChange = (newValue: "off" | "v1" | "v2") => { updateSettings({ enableProLazyEditsMode: newValue !== "off", proLazyEditsMode: newValue, }); }; const handleSmartContextChange = (newValue: "off" | "deep" | "balanced") => { if (newValue === "off") { updateSettings({ enableProSmartFilesContextMode: false, proSmartContextOption: undefined, }); } else if (newValue === "deep") { updateSettings({ enableProSmartFilesContextMode: true, proSmartContextOption: "deep", }); } else if (newValue === "balanced") { updateSettings({ enableProSmartFilesContextMode: true, proSmartContextOption: "balanced", }); } }; const toggleProEnabled = () => { updateSettings({ enableDyadPro: !settings?.enableDyadPro, }); }; const hasProKey = settings ? hasDyadProKey(settings) : false; const proModeTogglable = hasProKey && Boolean(settings?.enableDyadPro); return ( Configure Dyad Pro settings

Dyad Pro

{!hasProKey && (
{ IpcClient.getInstance().openExternalUrl( "https://dyad.sh/pro#ai", ); }} > Unlock Pro modes Visit dyad.sh/pro to unlock Pro features
)}
); } function SelectorRow({ id, label, tooltip, isTogglable, settingEnabled, toggle, }: { id: string; label: string; tooltip: string; isTogglable: boolean; settingEnabled: boolean; toggle: () => void; }) { return (
{tooltip}
); } function TurboEditsSelector({ isTogglable, settings, onValueChange, }: { isTogglable: boolean; settings: UserSettings | null; onValueChange: (value: "off" | "v1" | "v2") => void; }) { // Determine current value based on settings const getCurrentValue = (): "off" | "v1" | "v2" => { if (!settings?.enableProLazyEditsMode) { return "off"; } if (settings?.proLazyEditsMode === "v1") { return "v1"; } if (settings?.proLazyEditsMode === "v2") { return "v2"; } // Keep in sync with getModelClient in get_model_client.ts // If enabled but no option set (undefined/falsey), it's v1 return "v1"; }; const currentValue = getCurrentValue(); return (
Edits files efficiently without full rewrites.
  • Classic: Uses a smaller model to complete edits.
  • Search & replace: Find and replaces specific text blocks.
Disable Turbo Edits Uses a smaller model to complete edits Find and replaces specific text blocks
); } function SmartContextSelector({ isTogglable, settings, onValueChange, }: { isTogglable: boolean; settings: UserSettings | null; onValueChange: (value: "off" | "balanced" | "deep") => void; }) { // Determine current value based on settings const getCurrentValue = (): "off" | "conservative" | "balanced" | "deep" => { if (!settings?.enableProSmartFilesContextMode) { return "off"; } if (settings?.proSmartContextOption === "deep") { return "deep"; } if (settings?.proSmartContextOption === "balanced") { return "balanced"; } // Keep logic in sync with isDeepContextEnabled in chat_stream_handlers.ts return "deep"; }; const currentValue = getCurrentValue(); return (
Selects the most relevant files as context to save credits working on large codebases.
Disable Smart Context Selects most relevant files with balanced context size Experimental: Keeps full conversation history for maximum context and cache-optimized to control costs
); }