diff --git a/apps/desktop/src/hermes-profile-scope.test.ts b/apps/desktop/src/hermes-profile-scope.test.ts index b61518492e6..127fc12971d 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 5d19debb428..1bb60c7e3d8 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() }) }