diff --git a/metagpt/tools/azure_tts.py b/metagpt/tools/azure_tts.py index 3100e2a3a..0dc16d516 100644 --- a/metagpt/tools/azure_tts.py +++ b/metagpt/tools/azure_tts.py @@ -11,6 +11,7 @@ from pathlib import Path from uuid import uuid4 import base64 import sys +import aiofiles from metagpt.config import CONFIG, Config @@ -97,7 +98,7 @@ async def oas3_azsure_tts(text, lang="", voice="", style="", role="", subscripti filename = Path(__file__).resolve().parent / (str(uuid4()).replace("-", "") + ".wav") try: await tts.synthesize_speech(lang=lang, voice=voice, text=xml_value, output_file=str(filename)) - async with async_open(filename, mode="rb") as reader: + async with aiofiles.open(filename, mode="rb") as reader: data = await reader.read() base64_string = base64.b64encode(data).decode('utf-8') filename.unlink() diff --git a/requirements.txt b/requirements.txt index 25a480a68..ca7fcbfda 100644 --- a/requirements.txt +++ b/requirements.txt @@ -40,5 +40,4 @@ libcst==1.0.1 qdrant-client==1.4.0 connexion[swagger-ui] aiohttp_jinja2 -azure-cognitiveservices-speech==1.31.0 -aiofile \ No newline at end of file +azure-cognitiveservices-speech==1.31.0 \ No newline at end of file