@@ -37,32 +37,31 @@ async function textToSpeech(runtime: IAgentRuntime, text: string) {
37
37
await validateNodeConfig ( runtime ) ;
38
38
39
39
try {
40
- const body = {
41
- model_id : runtime . getSetting ( "ELEVENLABS_MODEL_ID" ) ,
42
- text : text ,
43
- voice_settings : {
44
- similarity_boost : runtime . getSetting (
45
- "ELEVENLABS_VOICE_SIMILARITY_BOOST"
46
- ) ,
47
- stability : runtime . getSetting ( "ELEVENLABS_VOICE_STABILITY" ) ,
48
- style : runtime . getSetting ( "ELEVENLABS_VOICE_STYLE" ) ,
49
- use_speaker_boost : runtime . getSetting (
50
- "ELEVENLABS_VOICE_USE_SPEAKER_BOOST"
51
- ) ,
52
- } ,
53
- } ;
54
- const options = {
55
- method : "POST" ,
56
- headers : {
57
- "Content-Type" : "application/json" ,
58
- "xi-api-key" : runtime . getSetting ( "ELEVENLABS_XI_API_KEY" ) ,
59
- } ,
60
- body : JSON . stringify ( body ) ,
61
- } ;
62
-
63
40
const response = await fetch (
64
41
`https://api.elevenlabs.io/v1/text-to-speech/${ runtime . getSetting ( "ELEVENLABS_VOICE_ID" ) } /stream?optimize_streaming_latency=${ runtime . getSetting ( "ELEVENLABS_OPTIMIZE_STREAMING_LATENCY" ) } &output_format=${ runtime . getSetting ( "ELEVENLABS_OUTPUT_FORMAT" ) } ` ,
65
- options
42
+ {
43
+ method : "POST" ,
44
+ headers : {
45
+ "Content-Type" : "application/json" ,
46
+ "xi-api-key" : runtime . getSetting ( "ELEVENLABS_XI_API_KEY" ) ,
47
+ } ,
48
+ body : JSON . stringify ( {
49
+ model_id : runtime . getSetting ( "ELEVENLABS_MODEL_ID" ) ,
50
+ text : text ,
51
+ voice_settings : {
52
+ similarity_boost : runtime . getSetting (
53
+ "ELEVENLABS_VOICE_SIMILARITY_BOOST"
54
+ ) ,
55
+ stability : runtime . getSetting (
56
+ "ELEVENLABS_VOICE_STABILITY"
57
+ ) ,
58
+ style : runtime . getSetting ( "ELEVENLABS_VOICE_STYLE" ) ,
59
+ use_speaker_boost : runtime . getSetting (
60
+ "ELEVENLABS_VOICE_USE_SPEAKER_BOOST"
61
+ ) ,
62
+ } ,
63
+ } ) ,
64
+ }
66
65
) ;
67
66
68
67
const status = response . status ;
0 commit comments