XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/gpt4free

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

989d3b86
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

2 个文件 +1 -2
Modified g4f/Provider/PollinationsAI.py +0 -1
@@ -484,7 +484,6 @@ class PollinationsAI(AsyncGeneratorProvider, ProviderModelMixin):
484 484 if "modalities" not in extra_body:
485 485 extra_body["modalities"] = ["text", "audio"]
486 486 stream = False
487 voice = extra_body.get("audio", {}).get("voice")
488 487 data = filter_none(
489 488 messages=list(render_messages(messages, media)),
490 489 model=model,
Modified g4f/Provider/template/OpenaiTemplate.py +1 -1
@@ -131,7 +131,7 @@ class OpenaiTemplate(AsyncGeneratorProvider, ProviderModelMixin, RaiseErrorMixin
131 131 yield ProviderInfo(**cls.get_dict(), model=model)
132 132 if "usage" in data:
133 133 yield Usage(**data["usage"])
134 if "choices" in choice:
134 if "choices" in data:
135 135 choice = data["choices"][0]
136 136 if "content" in choice["message"] and choice["message"]["content"]:
137 137 yield choice["message"]["content"].strip()