fix: implement tts_elevenlabs_token
This commit is contained in:
@@ -5,6 +5,10 @@ import * as https from 'https';
|
|||||||
|
|
||||||
const ELEVENLABS_API_ENDPOINT = 'api.elevenlabs.io';
|
const ELEVENLABS_API_ENDPOINT = 'api.elevenlabs.io';
|
||||||
|
|
||||||
|
/*
|
||||||
|
TO-DO: Implement previous text
|
||||||
|
*/
|
||||||
|
|
||||||
interface ElevenLabsVoice {
|
interface ElevenLabsVoice {
|
||||||
voice_id: string;
|
voice_id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -85,8 +89,21 @@ export class ElevenLabsTTS implements TTSModule {
|
|||||||
path: `/v1/text-to-speech/${voiceData.voice_id}/stream`,
|
path: `/v1/text-to-speech/${voiceData.voice_id}/stream`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'xi-api-key': config.tts_elevenlabs_key,
|
accept: 'application/json',
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json',
|
||||||
|
origin: 'https://elevenlabs.io',
|
||||||
|
'user-agent':
|
||||||
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36',
|
||||||
|
'Sec-Ch-Ua': '"Not)A;Brand";v="8", "Chromium";v="138"',
|
||||||
|
'Sec-Ch-Ua-Mobile': '?0',
|
||||||
|
'Sec-Ch-Ua-Platform': '"Windows"',
|
||||||
|
'Sec-Fetch-Site': 'same-site',
|
||||||
|
'Sec-Fetch-Mode': 'cors',
|
||||||
|
'Sec-Fetch-Dest': 'empty',
|
||||||
|
host: 'api.us.elevenlabs.io',
|
||||||
|
...(config.tts_elevenlabs_token
|
||||||
|
? { Authorization: `Bearer ${config.tts_elevenlabs_token}` }
|
||||||
|
: { 'xi-api-key': config.tts_elevenlabs_key })
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user