Is none check.

This commit is contained in:
retoor 2025-01-19 02:19:13 +01:00
parent f28084750f
commit 928ca39c8c

View File

@ -104,6 +104,8 @@ async def tts(text:str ,google_project:str="lisa-448004", language_code:str="nl-
response = await session.post(url, headers=headers, json=data)
response_json = await response.json()
audio_content = response_json.get("audioContent")
if not audio_content:
return
file = pathlib.Path(str(uuid.uuid4()) + ".mp3")
with file.open("wb") as audio_file:
audio_file.write(base64.b64decode(audio_content.encode('latin1')))