Compare commits

...

3 commits

Author SHA1 Message Date
hlohaus
9c7fc9fe4a Remove version declaration from Docker Compose files and update Dockerfile to streamline package installation 2025-11-14 19:52:57 +01:00
H Lohaus
f8978c1437
Update Dockerfile 2025-11-14 18:24:28 +01:00
hlohaus
fb26557dbb Fix model retrieval process in AnyModelProviderMixin
- Added error handling around model retrieval to prevent crashes when a provider fails.
- Ensured that exceptions during model fetching are logged for debugging purposes.
- Cleaned up the indentation and structure of the model retrieval logic for better readability.
2025-11-14 17:24:28 +01:00
5 changed files with 2402 additions and 1190 deletions

View file

@ -1,5 +1,3 @@
version: '3'
services: services:
g4f-slim: g4f-slim:
container_name: g4f-slim container_name: g4f-slim

View file

@ -1,5 +1,3 @@
version: '3'
services: services:
gpt4free: gpt4free:
image: hlohaus789/g4f:latest image: hlohaus789/g4f:latest

File diff suppressed because one or more lines are too long

View file

@ -195,18 +195,22 @@ class AnyModelProviderMixin(ProviderModelMixin):
cls.video_models.extend([clean_name(model) for model in provider.video_models]) cls.video_models.extend([clean_name(model) for model in provider.video_models])
for provider in Provider.__providers__: for provider in Provider.__providers__:
if provider.working and hasattr(provider, "get_models") and provider not in [AnyProvider, Custom, PollinationsImage, OpenaiAccount]: try:
for model in provider.get_models(): if provider.working and hasattr(provider, "get_models") and provider not in [AnyProvider, Custom, PollinationsImage, OpenaiAccount]:
clean = clean_name(model) for model in provider.get_models():
if clean in cls.model_map: clean = clean_name(model)
cls.model_map[clean].update({provider.__name__: model}) if clean in cls.model_map:
for alias, model in provider.model_aliases.items(): cls.model_map[clean].update({provider.__name__: model})
if alias in cls.model_map: for alias, model in provider.model_aliases.items():
cls.model_map[alias].update({provider.__name__: model}) if alias in cls.model_map:
if provider == GeminiPro: cls.model_map[alias].update({provider.__name__: model})
for model in cls.model_map.keys(): if provider == GeminiPro:
if "gemini" in model or "gemma" in model: for model in cls.model_map.keys():
cls.model_map[alias].update({provider.__name__: model}) if "gemini" in model or "gemma" in model:
cls.model_map[alias].update({provider.__name__: model})
except Exception as e:
debug.error(f"Error getting models for provider {provider.__name__}:", e)
continue
# Process audio providers # Process audio providers
for provider in [Microsoft_Phi_4_Multimodal, PollinationsAI]: for provider in [Microsoft_Phi_4_Multimodal, PollinationsAI]:
@ -220,7 +224,6 @@ class AnyModelProviderMixin(ProviderModelMixin):
cls.video_models.append("video") cls.video_models.append("video")
cls.model_map["video"] = {"Video": "video"} cls.model_map["video"] = {"Video": "video"}
del cls.model_map[""]
cls.audio_models = [*cls.audio_models] cls.audio_models = [*cls.audio_models]
# Create a mapping of parent providers to their children # Create a mapping of parent providers to their children

View file

@ -18,4 +18,3 @@ python-multipart
a2wsgi a2wsgi
python-dotenv python-dotenv
ddgs ddgs
aiofile