-
Notifications
You must be signed in to change notification settings - Fork 3
/
ChatSettingsDialog.js
46 lines (39 loc) · 1.23 KB
/
ChatSettingsDialog.js
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
import { AppController } from './AppController.js';
import { SettingsDialog } from './SettingsDialog.js';
import { Settings } from './models/Settings.js';
export class ChatSettingsDialog extends SettingsDialog {
constructor(options) {
super(options);
}
getSelected() {
return this.chat?.model;
}
async handleSystemPromptUpdated() {
this.chat.systemPrompt = this.systemPromptInput.value.trim();
await this.chat.save();
}
async handleModelUpdated() {
this.chat.model = this.modelList.getSelected();
await this.chat.save();
}
async handleModelParametersUpdated() {
this.chat.modelParameters = this.modelParametersInput.value.trim();
await this.chat.save();
}
async handleUrlUpdated() {
this.chat.url = this.urlInput.value.trim();
await this.chat.save();
}
loadSettings() {
AppController.getCurrentChat().then((chat) => {
this.modelList.setSelected(chat.model);
this.chat = chat;
this.urlInput.value = this.chat.url || Settings.getUrl();
const modelParameters =
this.chat.modelParameters || Settings.getModelParameters();
if (modelParameters) {
this.modelParametersInput.value = JSON.stringify(modelParameters, 2);
}
});
}
}