Fix settings sync

This commit is contained in:
dimitrievgs 2026-05-01 20:27:47 +03:00
parent 2dd033a010
commit 37bbc44741
2 changed files with 6 additions and 11 deletions

13
main.ts
View File

@ -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);

View File

@ -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>');