feat: update text_to_image skill

This commit is contained in:
莘权 马 2023-08-18 20:23:33 +08:00
parent 3715a69e3f
commit df5a50f6e6

View file

@ -12,7 +12,8 @@ from metagpt.tools.azure_tts import oas3_azsure_tts
from metagpt.utils.common import initialize_environment
def text_to_speech(text, lang="zh-CN", voice="zh-CN-XiaomoNeural", style="affectionate", role="Girl", subscription_key="", region=""):
def text_to_speech(text, lang="zh-CN", voice="zh-CN-XiaomoNeural", style="affectionate", role="Girl",
subscription_key="", region=""):
"""Text to speech
For more details, check out:`https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts`
@ -28,7 +29,7 @@ def text_to_speech(text, lang="zh-CN", voice="zh-CN-XiaomoNeural", style="affect
"""
initialize_environment()
if (os.environ.get("AZURE_TTS_SUBSCRIPTION_KEY") and os.environ.get("AZURE_TTS_REGION")) or \
(subscription_key and region):
(subscription_key and region):
return oas3_azsure_tts(text, lang, voice, style, role, subscription_key, region)
raise EnvironmentError