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:
@@ -26,6 +26,7 @@ export interface VoiceTokenResponse {
|
||||
export interface VoiceTokenRequest {
|
||||
customAgentId?: string
|
||||
customApiKey?: string
|
||||
voiceId?: string
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,6 +51,22 @@ export async function fetchVoiceToken(
|
||||
}
|
||||
}
|
||||
|
||||
export interface VoiceInfo {
|
||||
id: string
|
||||
name: string
|
||||
previewUrl: string
|
||||
category: string
|
||||
}
|
||||
|
||||
export async function fetchVoices(api: ApiClient): Promise<VoiceInfo[]> {
|
||||
try {
|
||||
const result = await api.fetchVoices()
|
||||
return result.voices
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
export interface ElevenLabsAgent {
|
||||
agent_id: string
|
||||
name: string
|
||||
|
||||
Reference in New Issue
Block a user