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

XFEstudio/gpt4free

Update OpenaiChat.py

a292ca31
H Lohaus <hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +5 -1
Modified g4f/Provider/needs_auth/OpenaiChat.py +5 -1
@@ -58,7 +58,8 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
58 58 supports_system_message = True
59 59 default_model = "auto"
60 60 default_vision_model = "gpt-4o"
61 fallback_models = [default_model, "gpt-4", "gpt-4o", "gpt-4o-mini", "gpt-4o-canmore", "o1-preview", "o1-mini"]
61 default_image_model = "dall-e-3"
62 fallback_models = [default_model, "gpt-4", "gpt-4o", "gpt-4o-mini", "gpt-4o-canmore", "o1-preview", "o1-mini", default_image_model]
62 63 vision_models = fallback_models
63 64 image_models = fallback_models
64 65 synthesize_content_type = "audio/mpeg"
@@ -76,6 +77,7 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
76 77 response.raise_for_status()
77 78 data = response.json()
78 79 cls.models = [model.get("slug") for model in data.get("models")]
80 cls.append(cls.default_image_model)
79 81 except Exception:
80 82 cls.models = cls.fallback_models
81 83 return cls.models
@@ -270,6 +272,8 @@ class OpenaiChat(AsyncGeneratorProvider, ProviderModelMixin):
270 272 Raises:
271 273 RuntimeError: If an error occurs during processing.
272 274 """
275 if model == cls.default_image_model:
276 model = cls.default_model
273 277 await cls.login(proxy)
274 278
275 279 async with StreamSession(