mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-30 14:35:17 +02:00
feat: archive
This commit is contained in:
parent
5079add5f8
commit
04b348e929
2 changed files with 31 additions and 15 deletions
|
|
@ -9,9 +9,7 @@
|
|||
import openai
|
||||
|
||||
from metagpt.config import CONFIG
|
||||
from metagpt.const import BASE64_FORMAT
|
||||
from metagpt.tools.azure_tts import oas3_azsure_tts
|
||||
from metagpt.utils.s3 import S3
|
||||
|
||||
|
||||
async def text_to_speech(
|
||||
|
|
@ -40,10 +38,10 @@ async def text_to_speech(
|
|||
audio_declaration = "data:audio/wav;base64,"
|
||||
if (CONFIG.AZURE_TTS_SUBSCRIPTION_KEY and CONFIG.AZURE_TTS_REGION) or (subscription_key and region):
|
||||
base64_data = await oas3_azsure_tts(text, lang, voice, style, role, subscription_key, region)
|
||||
s3 = S3()
|
||||
url = await s3.cache(data=base64_data, file_ext=".wav", format=BASE64_FORMAT)
|
||||
if url:
|
||||
return f"[{text}]({url})"
|
||||
# s3 = S3()
|
||||
# url = await s3.cache(data=base64_data, file_ext=".wav", format=BASE64_FORMAT)
|
||||
# if url:
|
||||
# return f"[{text}]({url})"
|
||||
return audio_declaration + base64_data if base64_data else base64_data
|
||||
|
||||
raise openai.error.InvalidRequestError("缺少必要的参数")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue