Skip to content

Commit 25c265d

Browse files
committed
Move ai assistant settings to its own section
1 parent b73113f commit 25c265d

File tree

3 files changed

+49
-14
lines changed

3 files changed

+49
-14
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import settingsPage from "components/settingsPage";
2+
import appSettings from "lib/settings";
3+
4+
export default function aiassistantSettings() {
5+
const title = "Ai Assistant Settings";
6+
const values = appSettings.value;
7+
const items = [
8+
{
9+
key: "aiApiKey",
10+
text: "AI Assistant API Key",
11+
value: values.aiApiKey,
12+
prompt: "AI Assistant API Key",
13+
},
14+
{
15+
key: "aiModel",
16+
text: "AI Assistant Model",
17+
value: values.aiModel,
18+
prompt: "AI Assistant Model",
19+
},
20+
];
21+
22+
return settingsPage(title, items, callback);
23+
24+
/**
25+
* Callback for settings page when an item is clicked
26+
* @param {string} key
27+
* @param {string} value
28+
*/
29+
function callback(key, value) {
30+
switch (key) {
31+
default:
32+
appSettings.update({
33+
[key]: value,
34+
});
35+
break;
36+
}
37+
}
38+
}

src/settings/appSettings.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,6 @@ export default function otherSettings() {
7171
value: values.console,
7272
select: [appSettings.CONSOLE_LEGACY, appSettings.CONSOLE_ERUDA],
7373
},
74-
{
75-
key: "aiApiKey",
76-
text: "AI Assistant API Key",
77-
value: values.aiApiKey,
78-
prompt: "AI Assistant API Key",
79-
},
80-
{
81-
key: "aiModel",
82-
text: "AI Assistant Model",
83-
value: values.aiModel,
84-
prompt: "AI Assistant Model",
85-
},
8674
{
8775
key: "keyboardMode",
8876
text: strings["keyboard mode"],

src/settings/mainSettings.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import previewSettings from "./previewSettings";
2121
import scrollSettings from "./scrollSettings";
2222
import searchSettings from "./searchSettings";
2323
import terminalSettings from "./terminalSettings";
24+
import aiassistantSettings from "./aiassistantSetting.js"
2425

2526
export default function mainSettings() {
2627
const title = strings.settings.capitalize();
@@ -79,19 +80,25 @@ export default function mainSettings() {
7980
key: "reset",
8081
text: strings["restore default settings"],
8182
icon: "historyrestore",
82-
index: 6,
83+
index: 7,
8384
},
8485
{
8586
key: "preview-settings",
8687
text: strings["preview settings"],
8788
icon: "play_arrow",
8889
index: 4,
8990
},
91+
{
92+
key: "ai-assistant-settings",
93+
text: "Ai Assistant Settings",
94+
// icon: "play_arrow",
95+
index: 5,
96+
},
9097
{
9198
key: "terminal-settings",
9299
text: `${strings["terminal settings"]}`,
93100
icon: "licons terminal",
94-
index: 5,
101+
index: 6,
95102
},
96103
{
97104
key: "editSettings",
@@ -124,6 +131,7 @@ export default function mainSettings() {
124131
case "backup-restore":
125132
case "editor-settings":
126133
case "preview-settings":
134+
case "ai-assistant-settings":
127135
case "terminal-settings":
128136
appSettings.uiSettings[key].show();
129137
break;
@@ -198,5 +206,6 @@ export default function mainSettings() {
198206
appSettings.uiSettings["scroll-settings"] = scrollSettings();
199207
appSettings.uiSettings["search-settings"] = searchSettings();
200208
appSettings.uiSettings["preview-settings"] = previewSettings();
209+
appSettings.uiSettings["ai-assistant-settings"] = aiassistantSettings();
201210
appSettings.uiSettings["terminal-settings"] = terminalSettings();
202211
}

0 commit comments

Comments
 (0)