save ai options

This commit is contained in:
end-4
2025-04-05 23:49:49 +02:00
parent 8fddaf2a3b
commit e8f01a4461
4 changed files with 173 additions and 108 deletions
+20 -10
View File
@@ -9,6 +9,7 @@ import { SystemMessage, ChatMessage } from "./ai_chatmessage.js";
import { ConfigToggle, ConfigSegmentedSelection, ConfigGap } from '../../.commonwidgets/configwidgets.js';
import { markdownTest } from '../../.miscutils/md2pango.js';
import { MarginRevealer } from '../../.widgethacks/advancedrevealers.js';
import { AgsToggle } from '../../.commonwidgets/configwidgets_apps.js';
const MODEL_NAME = `Gemini`;
@@ -92,33 +93,42 @@ export const GeminiSettings = () => MarginRevealer({
hpack: 'center',
className: 'sidebar-chat-settings-toggles',
children: [
ConfigToggle({
AgsToggle({
icon: 'model_training',
name: getString('Prompt'),
desc: getString("Tells Gemini:\n- It's a Linux sidebar assistant\n- Be brief and use bullet points"),
initValue: GeminiService.assistantPrompt,
onChange: (self, newValue) => {
option: "ai.enhancements",
extraOnChange: (self, newValue) => {
GeminiService.assistantPrompt = newValue;
},
extraOnReset: (self, newValue) => {
GeminiService.assistantPrompt = userOptions.ai.enhancements;
},
}),
ConfigToggle({
AgsToggle({
icon: 'shield',
name: getString('Safety'),
desc: getString("When turned off, tells the API (not the model) \nto not block harmful/explicit content"),
initValue: GeminiService.safe,
onChange: (self, newValue) => {
option: "ai.safety",
extraOnChange: (self, newValue) => {
GeminiService.safe = newValue;
},
extraOnReset: (self, newValue) => {
GeminiService.safe = userOptions.ai.safety;
},
}),
ConfigToggle({
AgsToggle({
icon: 'history',
name: getString('History'),
desc: getString("Saves chat history\nMessages in previous chats won't show automatically, but they are there"),
initValue: GeminiService.useHistory,
onChange: (self, newValue) => {
option: "ai.useHistory",
extraOnChange: (self, newValue) => {
GeminiService.useHistory = newValue;
},
}),
extraOnReset: (self, newValue) => {
GeminiService.useHistory = userOptions.ai.useHistory;
},
})
]
})
]