-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathGeneralSettings.tsx
More file actions
124 lines (115 loc) · 4.58 KB
/
Copy pathGeneralSettings.tsx
File metadata and controls
124 lines (115 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import React from "react";
import { Divider, Tooltip, Select, Flex, Switch } from "antd";
import { InfoCircleOutlined, MoonFilled, SunFilled } from "@ant-design/icons";
import AllowedWebsitesList from "./AllowedWebsitesList";
interface GeneralSettingsProps {
config: any;
darkMode: string;
setDarkMode: (mode: string) => void;
handleUpdateConfig: (changes: any) => void;
}
const GeneralSettings: React.FC<GeneralSettingsProps> = ({
config,
darkMode,
setDarkMode,
handleUpdateConfig,
}) => {
return (
<Flex vertical gap="small">
{/* Dark Mode Toggle */}
<Flex align="center" justify="space-between">
<span>
{darkMode === "dark" ? "Dark Mode" : "Light Mode"}
</span>
<button
onClick={() => setDarkMode(darkMode === "dark" ? "light" : "dark")}
>
{darkMode === "dark" ? (
<MoonFilled className="w-6 h-6" />
) : (
<SunFilled className="w-6 h-6" />
)}
</button>
</Flex>
<Divider style={{ margin: "0px" }} />
{/* Basic Settings */}
<Flex vertical gap="small">
<Flex align="center" justify="space-between" wrap>
<Flex align="center" justify="start" gap="small">
Action Approval Policy
<Tooltip title="Controls when approval is required before taking actions">
<InfoCircleOutlined className="text-secondary hover:text-primary cursor-help" />
</Tooltip>
</Flex>
<Select
value={config.approval_policy}
onChange={(value) => handleUpdateConfig({ approval_policy: value })}
options={[
{ value: "never", label: "Never require approval" },
{ value: "auto-conservative", label: "AI based judgement" },
{ value: "always", label: "Always require approval" },
]}
/>
</Flex>
<Divider style={{ margin: "0px" }} />
<AllowedWebsitesList
config={config}
handleUpdateConfig={handleUpdateConfig}
/>
<Divider style={{ margin: "0px" }} />
<Flex vertical gap="small">
<Flex align="center" justify="space-between" wrap gap="large">
<Flex align="center" justify="start" gap="small" wrap>
Allow Replans
<Tooltip title="When enabled, Magentic-UI will automatically replan if the current plan is not working or you change the original request">
<InfoCircleOutlined className="text-secondary hover:text-primary cursor-help" />
</Tooltip>
</Flex>
<Switch
checked={config.allow_for_replans}
checkedChildren="ON"
unCheckedChildren="OFF"
onChange={(checked) => handleUpdateConfig({ allow_for_replans: checked })}
/>
</Flex>
<Divider style={{ margin: "0px" }} />
<Flex align="center" justify="space-between" wrap gap="large">
<Flex align="center" justify="start" gap="small" wrap>
Browser Headless
<Tooltip title="Only applicable when running without docker. When enabled, the browser will run in headless mode (no UI).">
<InfoCircleOutlined className="text-secondary hover:text-primary cursor-help" />
</Tooltip>
</Flex>
<Switch
checked={config.browser_headless}
checkedChildren="ON"
unCheckedChildren="OFF"
onChange={(checked) =>
handleUpdateConfig({ browser_headless: checked })
}
/>
</Flex>
<Divider style={{ margin: "0px" }} />
<Flex align="center" justify="space-between" wrap gap="small">
<Flex align="center" gap="small">
Retrieve Relevant Plans
<Tooltip title="Controls how Magentic-UI retrieves and uses relevant plans from previous sessions">
<InfoCircleOutlined className="text-secondary hover:text-primary cursor-help" />
</Tooltip>
</Flex>
<Select
value={config.retrieve_relevant_plans}
onChange={(value) => handleUpdateConfig({ retrieve_relevant_plans: value })}
options={[
{ value: "never", label: "No plan retrieval" },
{ value: "hint", label: "Retrieve plans as hints" },
{ value: "reuse", label: "Retrieve plans to use directly" },
]}
/>
</Flex>
</Flex>
</Flex>
</Flex>
);
};
export default GeneralSettings;