Skip to content

Commit 79f3ce4

Browse files
cleanup
1 parent e1a838c commit 79f3ce4

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

packages/plugin-node/src/services/speech.ts

+23-24
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,31 @@ async function textToSpeech(runtime: IAgentRuntime, text: string) {
3737
await validateNodeConfig(runtime);
3838

3939
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-
6340
const response = await fetch(
6441
`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+
}
6665
);
6766

6867
const status = response.status;

pnpm-lock.yaml

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)