mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-29 18:46:59 +00:00
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
This commit is contained in:
parent
e04c2a9ebd
commit
a2b0c314ae
2 changed files with 24 additions and 1 deletions
|
|
@ -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')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1513,6 +1513,7 @@ export function transcribeAudio(dataUrl: string, mimeType?: string): Promise<Aud
|
|||
return window.hermesDesktop.api<AudioTranscriptionResponse>({
|
||||
path: '/api/audio/transcribe',
|
||||
method: 'POST',
|
||||
...profileScoped(),
|
||||
body: {
|
||||
data_url: dataUrl,
|
||||
mime_type: mimeType
|
||||
|
|
@ -1528,6 +1529,7 @@ export function speakText(text: string): Promise<AudioSpeakResponse> {
|
|||
return window.hermesDesktop.api<AudioSpeakResponse>({
|
||||
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<AudioSpeakResponse> {
|
|||
|
||||
export function getElevenLabsVoices(): Promise<ElevenLabsVoicesResponse> {
|
||||
return window.hermesDesktop.api<ElevenLabsVoicesResponse>({
|
||||
path: '/api/audio/elevenlabs/voices'
|
||||
path: '/api/audio/elevenlabs/voices',
|
||||
...profileScoped()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue