mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat(voice): dynamic settings voice picker with safe fallback + preview (#690)
* feat(voice): dynamic settings voice picker with safe fallback + preview * fix(voice): honor picker with configured agent and stop preview on unmount * fix(voice): apply PR review feedback for agent selection and preview cleanup
This commit is contained in:
+19
-1
@@ -538,7 +538,7 @@ export class ApiClient {
|
||||
})
|
||||
}
|
||||
|
||||
async fetchVoiceToken(options?: { customAgentId?: string; customApiKey?: string }): Promise<{
|
||||
async fetchVoiceToken(options?: { customAgentId?: string; customApiKey?: string; voiceId?: string }): Promise<{
|
||||
allowed: boolean
|
||||
token?: string
|
||||
agentId?: string
|
||||
@@ -549,4 +549,22 @@ export class ApiClient {
|
||||
body: JSON.stringify(options || {})
|
||||
})
|
||||
}
|
||||
|
||||
async fetchVoices(): Promise<{ voices: Array<{ id: string; name: string; previewUrl: string; category: string }> }> {
|
||||
return await this.request('/api/voice/voices')
|
||||
}
|
||||
|
||||
async sendVoiceTelemetry(event: {
|
||||
stage: string
|
||||
message: string
|
||||
sessionId?: string
|
||||
voiceId?: string
|
||||
language?: string
|
||||
details?: Record<string, unknown>
|
||||
}): Promise<void> {
|
||||
await this.request('/api/voice/telemetry', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(event)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user