mnemo_cards/mnemo_cards_admin/src/api/voiceService.ts
Dmitry 03e1e0b478
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Deploy Admin Panel / Deploy Admin Panel (push) Waiting to run
Deploy Admin Panel / Admin Panel Verification (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
lang
2026-01-24 19:59:04 +03:00

33 lines
No EOL
878 B
TypeScript

import { adminApiClient } from './client'
export interface GenerateTTSResponse {
objectId: string
url: string // Presigned URL for preview
}
export const voiceServiceApi = {
/**
* Generate TTS audio from text via backend API
* Backend calls voice-service, which handles caching, and saves to MinIO
* @param text Text to convert to speech
* @param voice Voice identifier (optional, defaults to 'alloy')
* @param language Language code (optional)
* @returns Object ID and presigned URL
*/
async generateTTS(
text: string,
voice?: string,
language?: string
): Promise<GenerateTTSResponse> {
const response = await adminApiClient.post<GenerateTTSResponse>(
'/api/v2/media/generate-tts',
{
text,
voice: voice || 'alloy',
...(language && { language }),
}
)
return response.data
},
}