diff --git a/src/components/AutoApproveSwitch.tsx b/src/components/AutoApproveSwitch.tsx new file mode 100644 index 0000000..2961a6f --- /dev/null +++ b/src/components/AutoApproveSwitch.tsx @@ -0,0 +1,19 @@ +import { useSettings } from "@/hooks/useSettings"; +import { Label } from "@/components/ui/label"; +import { Switch } from "@/components/ui/switch"; + +export function AutoApproveSwitch() { + const { settings, updateSettings } = useSettings(); + return ( +
+ + updateSettings({ autoApproveChanges: !settings?.autoApproveChanges }) + } + /> + +
+ ); +} diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx index 1ad5f13..16f8c03 100644 --- a/src/components/chat/ChatInput.tsx +++ b/src/components/chat/ChatInput.tsx @@ -35,6 +35,7 @@ import { import type { Message } from "@/ipc/ipc_types"; import { isPreviewOpenAtom } from "@/atoms/viewAtoms"; import { useRunApp } from "@/hooks/useRunApp"; +import { AutoApproveSwitch } from "../AutoApproveSwitch"; export function ChatInput({ chatId }: { chatId?: number }) { const [inputValue, setInputValue] = useAtom(chatInputValueAtom); @@ -302,16 +303,6 @@ function ActionProposalActions({ proposal }: { proposal: ActionProposal }) { ); } -function AutoApproveSwitch() { - // const [autoApprove, setAutoApprove] = useAtom(autoApproveAtom); - return ( -
- - -
- ); -} - interface ChatInputActionsProps { proposal: Proposal; onApprove: () => void; diff --git a/src/pages/settings.tsx b/src/pages/settings.tsx index dfe2b2f..f96ce66 100644 --- a/src/pages/settings.tsx +++ b/src/pages/settings.tsx @@ -4,6 +4,7 @@ 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"; export default function SettingsPage() { const { theme, setTheme } = useTheme(); @@ -63,10 +64,17 @@ export default function SettingsPage() {

- Appearance + General Settings

+
+ +
+ This will automatically approve code changes and run them. +
+
+