voice
This commit is contained in:
parent
925e7eaf99
commit
19baa05f55
3 changed files with 3 additions and 3 deletions
|
|
@ -26,7 +26,7 @@ export class VoiceController {
|
||||||
@Res() res: Response,
|
@Res() res: Response,
|
||||||
) {
|
) {
|
||||||
this.logger.log('POST /voice/tts - Request received');
|
this.logger.log('POST /voice/tts - Request received');
|
||||||
const { text, voice = 'sarah' } = body;
|
const { text, voice } = body;
|
||||||
this.logger.debug(`Request body: text="${text?.substring(0, 50)}...", voice=${voice}`);
|
this.logger.debug(`Request body: text="${text?.substring(0, 50)}...", voice=${voice}`);
|
||||||
|
|
||||||
if (!text) {
|
if (!text) {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export class VoiceService {
|
||||||
this.logger.log(`VoiceService initialized with URL: ${this.voiceServiceUrl}`);
|
this.logger.log(`VoiceService initialized with URL: ${this.voiceServiceUrl}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async generateTTS(text: string, voice: string = 'sarah'): Promise<Buffer> {
|
async generateTTS(text: string, voice?: string): Promise<Buffer> {
|
||||||
this.logger.log(`Generating TTS for text: "${text.substring(0, 50)}..." with voice: ${voice}`);
|
this.logger.log(`Generating TTS for text: "${text.substring(0, 50)}..." with voice: ${voice}`);
|
||||||
try {
|
try {
|
||||||
const url = `${this.voiceServiceUrl}/api/voice/tts`;
|
const url = `${this.voiceServiceUrl}/api/voice/tts`;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export function useVoice() {
|
||||||
* @returns {Promise<string>} Audio URL
|
* @returns {Promise<string>} Audio URL
|
||||||
*/
|
*/
|
||||||
const generateSpeech = useCallback(async (text, options = {}) => {
|
const generateSpeech = useCallback(async (text, options = {}) => {
|
||||||
const { voice = 'sarah', cache = true } = options;
|
const { cache = true } = options;
|
||||||
|
|
||||||
// Check cache first
|
// Check cache first
|
||||||
const cacheKey = `${text}_${voice}`;
|
const cacheKey = `${text}_${voice}`;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue