Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Nov 22, 2024
1 parent e1a838c commit 79f3ce4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
47 changes: 23 additions & 24 deletions packages/plugin-node/src/services/speech.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,32 +37,31 @@ async function textToSpeech(runtime: IAgentRuntime, text: string) {
await validateNodeConfig(runtime);

try {
const body = {
model_id: runtime.getSetting("ELEVENLABS_MODEL_ID"),
text: text,
voice_settings: {
similarity_boost: runtime.getSetting(
"ELEVENLABS_VOICE_SIMILARITY_BOOST"
),
stability: runtime.getSetting("ELEVENLABS_VOICE_STABILITY"),
style: runtime.getSetting("ELEVENLABS_VOICE_STYLE"),
use_speaker_boost: runtime.getSetting(
"ELEVENLABS_VOICE_USE_SPEAKER_BOOST"
),
},
};
const options = {
method: "POST",
headers: {
"Content-Type": "application/json",
"xi-api-key": runtime.getSetting("ELEVENLABS_XI_API_KEY"),
},
body: JSON.stringify(body),
};

const response = await fetch(
`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")}`,
options
{
method: "POST",
headers: {
"Content-Type": "application/json",
"xi-api-key": runtime.getSetting("ELEVENLABS_XI_API_KEY"),
},
body: JSON.stringify({
model_id: runtime.getSetting("ELEVENLABS_MODEL_ID"),
text: text,
voice_settings: {
similarity_boost: runtime.getSetting(
"ELEVENLABS_VOICE_SIMILARITY_BOOST"
),
stability: runtime.getSetting(
"ELEVENLABS_VOICE_STABILITY"
),
style: runtime.getSetting("ELEVENLABS_VOICE_STYLE"),
use_speaker_boost: runtime.getSetting(
"ELEVENLABS_VOICE_USE_SPEAKER_BOOST"
),
},
}),
}
);

const status = response.status;
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 79f3ce4

Please sign in to comment.