mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
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:
parent
2812c30987
commit
989d3b8602
2 changed files with 1 additions and 2 deletions
|
|
@ -484,7 +484,6 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
|
||||||
if "modalities" not in extra_body:
|
if "modalities" not in extra_body:
|
||||||
extra_body["modalities"] = ["text", "audio"]
|
extra_body["modalities"] = ["text", "audio"]
|
||||||
stream = False
|
stream = False
|
||||||
voice = extra_body.get("audio", {}).get("voice")
|
|
||||||
data = filter_none(
|
data = filter_none(
|
||||||
messages=list(render_messages(messages, media)),
|
messages=list(render_messages(messages, media)),
|
||||||
model=model,
|
model=model,
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ class OpenaiTemplate(AsyncGeneratorProvider, ProviderModelMixin, RaiseErrorMixin
|
||||||
yield ProviderInfo(**cls.get_dict(), model=model)
|
yield ProviderInfo(**cls.get_dict(), model=model)
|
||||||
if "usage" in data:
|
if "usage" in data:
|
||||||
yield Usage(**data["usage"])
|
yield Usage(**data["usage"])
|
||||||
if "choices" in choice:
|
if "choices" in data:
|
||||||
choice = data["choices"][0]
|
choice = data["choices"][0]
|
||||||
if "content" in choice["message"] and choice["message"]["content"]:
|
if "content" in choice["message"] and choice["message"]["content"]:
|
||||||
yield choice["message"]["content"].strip()
|
yield choice["message"]["content"].strip()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue