From a2b0c314aea7cd37b1e3acceb6bcdb339cd1a9a6 Mon Sep 17 00:00:00 2001 From: Bartok9 Date: Sat, 27 Jun 2026 03:44:38 -0400 Subject: [PATCH] fix(desktop): scope audio endpoints to the active profile transcribeAudio/speakText/getElevenLabsVoices called the backend without profileScoped(), so for a non-default profile they hit the default backend config instead of the active profile - playback used the wrong TTS/voice even though settings were saved to the active profile config. Fixes #53441 --- apps/desktop/src/hermes-profile-scope.test.ts | 20 +++++++++++++++++++ apps/desktop/src/hermes.ts | 5 ++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/hermes-profile-scope.test.ts b/apps/desktop/src/hermes-profile-scope.test.ts index b61518492e6e..127fc12971d1 100644 --- a/apps/desktop/src/hermes-profile-scope.test.ts +++ b/apps/desktop/src/hermes-profile-scope.test.ts @@ -3,11 +3,14 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { checkHermesUpdate, getActionStatus, + getElevenLabsVoices, getMemoryProviderConfig, getStatus, restartGateway, saveMemoryProviderConfig, setApiRequestProfile, + speakText, + transcribeAudio, updateHermes } from './hermes' @@ -59,4 +62,21 @@ describe('backend action helpers are profile-scoped', () => { expect(call[0].profile).toBe('coder') } }) + + // Audio endpoints (transcribe / speak / voices) write to the active + // profile's config in the settings UI but historically called the backend + // without a profile scope, so playback used the default profile's TTS/voice + // config instead of the active one (#53441). + it('forwards the active profile to audio endpoints', () => { + setApiRequestProfile('jarvis') + + void transcribeAudio('data:audio/webm;base64,AAAA', 'audio/webm') + void speakText('hello') + void getElevenLabsVoices() + + expect(api.mock.calls).toHaveLength(3) + for (const call of api.mock.calls) { + expect(call[0].profile).toBe('jarvis') + } + }) }) diff --git a/apps/desktop/src/hermes.ts b/apps/desktop/src/hermes.ts index 5d19debb4287..1bb60c7e3d8c 100644 --- a/apps/desktop/src/hermes.ts +++ b/apps/desktop/src/hermes.ts @@ -1513,6 +1513,7 @@ export function transcribeAudio(dataUrl: string, mimeType?: string): Promise({ path: '/api/audio/transcribe', method: 'POST', + ...profileScoped(), body: { data_url: dataUrl, mime_type: mimeType @@ -1528,6 +1529,7 @@ export function speakText(text: string): Promise { return window.hermesDesktop.api({ path: '/api/audio/speak', method: 'POST', + ...profileScoped(), body: { text }, // TTS blocks until provider synthesis, file read, and base64 encoding // finish. Remote providers and large messages regularly exceed the @@ -1538,7 +1540,8 @@ export function speakText(text: string): Promise { export function getElevenLabsVoices(): Promise { return window.hermesDesktop.api({ - path: '/api/audio/elevenlabs/voices' + path: '/api/audio/elevenlabs/voices', + ...profileScoped() }) }