返回提交历史
Modified
g4f/Provider/TypeGPT.py
+7
-2
XFEstudio/gpt4free
Fix unittests
8132cf6a
代码差异
1 个文件
+7
-2
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
import requests
4
4
5
5
from .template import OpenaiTemplate
6
from .. import debug
6
7
7
8
class TypeGPT(OpenaiTemplate):
8
9
label = "TypeGpt"
@@ -36,6 +37,10 @@ class TypeGPT(OpenaiTemplate):
36
37
@classmethod
37
38
def get_models(cls, **kwargs):
38
39
if not cls.models:
39
cls.models = requests.get(f"{cls.url}/api/config").json()["customModels"].split(",")
40
cls.models = [model.split("@")[0].strip("+") for model in cls.models if not model.startswith("-") and model not in cls.image_models]
40
try:
41
cls.models = requests.get(f"{cls.url}/api/config").json()["customModels"].split(",")
42
cls.models = [model.split("@")[0].strip("+") for model in cls.models if not model.startswith("-") and model not in cls.image_models]
43
except Exception as e:
44
cls.models = cls.fallback_models
45
debug.log(f"Error fetching models: {e}")
41
46
return cls.models