mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
Merge branch 'feat/enhance-multi-modal-support' into deploy/dev
This commit is contained in:
commit
81aafbcf69
|
@ -26,8 +26,8 @@ class PodcastAudioGeneratorTool(BuiltinTool):
|
||||||
index: int,
|
index: int,
|
||||||
) -> tuple[int, Union[AudioSegment, str], Optional[AudioSegment]]:
|
) -> tuple[int, Union[AudioSegment, str], Optional[AudioSegment]]:
|
||||||
try:
|
try:
|
||||||
response = client.audio.speech.create(model="tts-1", voice=voice, input=line.strip())
|
response = client.audio.speech.create(model="tts-1", voice=voice, input=line.strip(), response_format="wav")
|
||||||
audio = AudioSegment.from_file(io.BytesIO(response.content), format="wav")
|
audio = AudioSegment.from_wav(io.BytesIO(response.content))
|
||||||
silence_duration = random.uniform(0.1, 1.5)
|
silence_duration = random.uniform(0.1, 1.5)
|
||||||
silence = PodcastAudioGeneratorTool._generate_silence(silence_duration)
|
silence = PodcastAudioGeneratorTool._generate_silence(silence_duration)
|
||||||
return index, audio, silence
|
return index, audio, silence
|
||||||
|
|
Loading…
Reference in New Issue
Block a user