Support setting with path to vosk model
This commit is contained in:
parent
63ca8f2a73
commit
9aefdaaa69
16
main.ts
16
main.ts
|
|
@ -43,6 +43,7 @@ interface LLMAgentSettings {
|
||||||
markerStart: string;
|
markerStart: string;
|
||||||
markerStop: string;
|
markerStop: string;
|
||||||
|
|
||||||
|
voskModelPath: string;
|
||||||
showVoicePanel: boolean;
|
showVoicePanel: boolean;
|
||||||
|
|
||||||
lastActiveGraphId: string | null;
|
lastActiveGraphId: string | null;
|
||||||
|
|
@ -78,6 +79,7 @@ const DEFAULT_SETTINGS: LLMAgentSettings = {
|
||||||
markerStart: 'старт',
|
markerStart: 'старт',
|
||||||
markerStop: 'стоп',
|
markerStop: 'стоп',
|
||||||
|
|
||||||
|
voskModelPath: '',
|
||||||
showVoicePanel: false,
|
showVoicePanel: false,
|
||||||
|
|
||||||
lastActiveGraphId: null,
|
lastActiveGraphId: null,
|
||||||
|
|
@ -536,6 +538,20 @@ class SampleSettingTab extends PluginSettingTab {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
new Setting(containerEl)
|
||||||
|
.setName('Путь к модели Vosk')
|
||||||
|
.setDesc('Абсолютный путь к папке с распакованной языковой моделью (например: C:\\vosk-models\\vosk-model-small-ru)')
|
||||||
|
.addText((text) =>
|
||||||
|
text
|
||||||
|
.setPlaceholder('Путь к модели на диске')
|
||||||
|
.setValue(this.plugin.settings.voskModelPath)
|
||||||
|
.onChange(async (value) => {
|
||||||
|
this.plugin.settings.voskModelPath = value.replace(/"/g, '').trim(); // Убираем кавычки, если скопировали путь как путь
|
||||||
|
await this.plugin.saveSettings();
|
||||||
|
await this.plugin.syncSettings();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
containerEl.createEl('h2', { text: 'Управление ссылками и файлами' });
|
containerEl.createEl('h2', { text: 'Управление ссылками и файлами' });
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,8 @@ export class ChatPanel {
|
||||||
|
|
||||||
if (this.props.plugin.settings) {
|
if (this.props.plugin.settings) {
|
||||||
this.props.plugin.settings.defaultModel = model;
|
this.props.plugin.settings.defaultModel = model;
|
||||||
// TODO: Сохранение настройки здесь может привести к зацикливанию
|
// TODO: Сохранение настройки здесь может привести к зацикливанию и не уверен, что вообще стоит здесь менять defaultModel
|
||||||
|
// TODO: Это костыль для устранения бага со сбросом выбора модели при отправке запроса, нужно выяснить его причину
|
||||||
// Не обязательно сохранять в файл сразу, но ChatView должен видеть актуальное значение
|
// Не обязательно сохранять в файл сразу, но ChatView должен видеть актуальное значение
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user