[verified] fix(desktop): scope TTS requests to active profile

This commit is contained in:
Bryan Roller 2026-07-22 12:02:59 -04:00 committed by Teknium
parent a2b0c314ae
commit 3a1efa5e30
2 changed files with 6 additions and 2 deletions

View file

@ -19,6 +19,7 @@ import {
listSessions,
listSidebarSessions,
resetSidebarBatchCapability,
setApiRequestProfile,
speakText,
transcribeAudio
} from './hermes'
@ -44,6 +45,7 @@ describe('Hermes REST helpers', () => {
})
afterEach(() => {
setApiRequestProfile(null)
vi.restoreAllMocks()
Reflect.deleteProperty(window, 'hermesDesktop')
})
@ -337,7 +339,8 @@ describe('Hermes REST helpers', () => {
expect(audioSpeakRequestTimeoutMs('x'.repeat(100_000))).toBe(AUDIO_SPEAK_MAX_REQUEST_TIMEOUT_MS)
})
it('uses an extended timeout for blocking TTS synthesis', async () => {
it('routes blocking TTS synthesis through the active profile backend', async () => {
setApiRequestProfile('rhaegal')
api.mockResolvedValueOnce({
data_url: 'data:audio/mpeg;base64,AA==',
mime_type: 'audio/mpeg',
@ -356,6 +359,7 @@ describe('Hermes REST helpers', () => {
body: { text: 'Read this aloud' },
method: 'POST',
path: '/api/audio/speak',
profile: 'rhaegal',
timeoutMs: AUDIO_SPEAK_MIN_REQUEST_TIMEOUT_MS
})
})

View file

@ -1527,9 +1527,9 @@ export function transcribeAudio(dataUrl: string, mimeType?: string): Promise<Aud
export function speakText(text: string): Promise<AudioSpeakResponse> {
return window.hermesDesktop.api<AudioSpeakResponse>({
...profileScoped(),
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