fix: remove redundant lookup for "audio" voice in PollinationsAI.py and fix key reference in OpenaiTemplate.py

- Removed the line retrieving "voice" from "audio" key inside the PollinationsAI.py file
- Changed the condition in OpenaiTemplate.py from checking "choices" in data to "choices" in data before accessing data["choices"][0] in OpenaiTemplate.py
This commit is contained in:
hlohaus 2025-06-19 02:12:44 +02:00
parent 2812c30987
commit 989d3b8602
2 changed files with 1 additions and 2 deletions

View file

@ -484,7 +484,6 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
if "modalities" not in extra_body:
extra_body["modalities"] = ["text", "audio"]
stream = False
voice = extra_body.get("audio", {}).get("voice")
data = filter_none(
messages=list(render_messages(messages, media)),
model=model,

View file

@ -131,7 +131,7 @@ class OpenaiTemplate(AsyncGeneratorProvider, ProviderModelMixin, RaiseErrorMixin
yield ProviderInfo(**cls.get_dict(), model=model)
if "usage" in data:
yield Usage(**data["usage"])
if "choices" in choice:
if "choices" in data:
choice = data["choices"][0]
if "content" in choice["message"] and choice["message"]["content"]:
yield choice["message"]["content"].strip()