mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Fix unittests
This commit is contained in:
parent
e2bb1b1f0d
commit
8132cf6abc
1 changed files with 7 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
import requests
|
||||
|
||||
from .template import OpenaiTemplate
|
||||
from .. import debug
|
||||
|
||||
class TypeGPT(OpenaiTemplate):
|
||||
label = "TypeGpt"
|
||||
|
|
@ -36,6 +37,10 @@ class TypeGPT(OpenaiTemplate):
|
|||
@classmethod
|
||||
def get_models(cls, **kwargs):
|
||||
if not cls.models:
|
||||
cls.models = requests.get(f"{cls.url}/api/config").json()["customModels"].split(",")
|
||||
cls.models = [model.split("@")[0].strip("+") for model in cls.models if not model.startswith("-") and model not in cls.image_models]
|
||||
try:
|
||||
cls.models = requests.get(f"{cls.url}/api/config").json()["customModels"].split(",")
|
||||
cls.models = [model.split("@")[0].strip("+") for model in cls.models if not model.startswith("-") and model not in cls.image_models]
|
||||
except Exception as e:
|
||||
cls.models = cls.fallback_models
|
||||
debug.log(f"Error fetching models: {e}")
|
||||
return cls.models
|
||||
Loading…
Add table
Add a link
Reference in a new issue