feat: Refactor extra_body handling and update model error handling

- Changed the default value of `extra_body` from an empty dictionary to `None` in `ImageLabs` and `PollinationsAI` classes.
- Added a check to initialize `extra_body` to an empty dictionary if it is `None` in the `ImageLabs` class.
- Removed the `extra_image_models` list from the `PollinationsAI` class.
- Updated the way image models are combined in the `PollinationsAI` class to avoid duplicates.
- Changed the error handling for unsupported models from `ModelNotSupportedError` to `ModelNotFoundError` in multiple classes including `OpenaiChat`, `HuggingFaceAPI`, and `HuggingFaceInference`.
- Updated the `save_response_media` function to handle both string and bytes responses.
- Adjusted the handling of audio data in the `PollinationsAI` class to ensure proper processing of audio responses.
This commit is contained in:
hlohaus 2025-06-12 02:29:41 +02:00
parent 15d8318ab7
commit bf4ed09ab9
20 changed files with 166 additions and 152 deletions

View file

@ -257,7 +257,7 @@ class Api:
}
def handle_provider(self, provider_handler, model):
if model:
if not getattr(provider_handler, "model", False):
return self._format_json("provider", {**provider_handler.get_dict(), "model": model})
return self._format_json("provider", provider_handler.get_dict())