Fix settings sync
This commit is contained in:
parent
2dd033a010
commit
37bbc44741
13
main.ts
13
main.ts
|
|
@ -61,19 +61,10 @@ export default class LLMAgentPlugin extends Plugin {
|
||||||
const response = await fetch(`${this.settings.apiBaseUrl}/settings/sync`, {
|
const response = await fetch(`${this.settings.apiBaseUrl}/settings/sync`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify(this.settings)
|
||||||
systemPrompt: this.settings.systemPrompt,
|
|
||||||
interval: this.settings.voiceInterval,
|
|
||||||
context_limit: this.settings.voiceContextLimit,
|
|
||||||
marker_start: this.settings.markerStart,
|
|
||||||
marker_stop: this.settings.markerStop,
|
|
||||||
// Передаем также пути к файлам промптов, если нужно
|
|
||||||
prompt_regular: this.settings.promptRegularPath,
|
|
||||||
prompt_commands: this.settings.promptCommandsPath
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
console.log("LLM Agent: Voice settings synced with backend.");
|
console.log("LLM Agent: Settings synced with backend.");
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("LLM Agent: Failed to sync settings", e);
|
console.error("LLM Agent: Failed to sync settings", e);
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,10 @@ export class VoicePanel {
|
||||||
updateContent(data: any) {
|
updateContent(data: any) {
|
||||||
const body = this.container.querySelector('#v-body');
|
const body = this.container.querySelector('#v-body');
|
||||||
if (!body) return;
|
if (!body) return;
|
||||||
|
if (data.obsidian_settings_fetched == false) // если это не сделать, то на беке останутся пустые настройки, если обсидиан запущен раньше бека
|
||||||
|
{
|
||||||
|
this.plugin.syncVoiceSettings();
|
||||||
|
}
|
||||||
if (this.activeTab === 'trans') body.textContent = data.transcription;
|
if (this.activeTab === 'trans') body.textContent = data.transcription;
|
||||||
if (this.activeTab === 'res1') body.textContent = data.response1;
|
if (this.activeTab === 'res1') body.textContent = data.response1;
|
||||||
if (this.activeTab === 'res2') body.innerHTML = data.response2.join('<br>---<br>');
|
if (this.activeTab === 'res2') body.innerHTML = data.response2.join('<br>---<br>');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user