mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-12-24 03:23:49 +03:00
refactor(g4f/gui/server/api.py): streamline model retrieval logic
This commit is contained in:
parent
3dcacd842d
commit
fda90aa8f5
@ -43,13 +43,8 @@ class Api():
|
||||
provider: ProviderType = __map__[provider]
|
||||
if issubclass(provider, ProviderModelMixin):
|
||||
return [{"model": model, "default": model == provider.default_model} for model in provider.get_models()]
|
||||
elif provider.supports_gpt_35_turbo or provider.supports_gpt_4:
|
||||
return [
|
||||
*([{"model": "gpt-4", "default": not provider.supports_gpt_4}] if provider.supports_gpt_4 else []),
|
||||
*([{"model": "gpt-3.5-turbo", "default": not provider.supports_gpt_4}] if provider.supports_gpt_35_turbo else [])
|
||||
]
|
||||
else:
|
||||
return [];
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def get_image_models() -> list[dict]:
|
||||
|
Loading…
Reference in New Issue
Block a user