mirror of
				https://github.com/xtekky/gpt4free.git
				synced 2025-10-31 19:42:45 +08:00 
			
		
		
		
	fix: improve message formatting and set default activation for providers
- In PerplexityLabs.py, added logic to filter consecutive assistant messages and update message array accordingly - Modified PerplexityLabs.py to change "messages" field to use the new formatted message list - Adjusted error handling in PerplexityLabs.py to include a newline in error messages - Import os in BlackForestLabs_Flux1KontextDev.py and replace media filename assignment with basename if media is None - In Groq.py, set "active_by_default" to True for the provider - In OpenRouter.py, added "active_by_default" as True - In Together.py, set "active_by_default" to True - In HuggingFaceInference.py, set "working" to False - In models.py, changed default_model to "openai/gpt-oss-120b" instead of previous value - In backend_api.py, added a null check in jsonify_provider_models to return 404 if response is None, and simplified get_provider_models call
This commit is contained in:
		| @@ -122,6 +122,8 @@ class Backend_Api(Api): | ||||
|         def jsonify_provider_models(**kwargs): | ||||
|             try: | ||||
|                 response = self.get_provider_models(**kwargs) | ||||
|                 if response is None: | ||||
|                     return jsonify({"error": {"message": "Provider not found"}}), 404 | ||||
|             except MissingAuthError as e: | ||||
|                 return jsonify({"error": {"message": f"{type(e).__name__}: {e}"}}), 401 | ||||
|             except Exception as e: | ||||
| @@ -596,10 +598,7 @@ class Backend_Api(Api): | ||||
|         api_key = request.headers.get("x_api_key") | ||||
|         api_base = request.headers.get("x_api_base") | ||||
|         ignored = request.headers.get("x_ignored", "").split() | ||||
|         models = super().get_provider_models(provider, api_key, api_base, ignored) | ||||
|         if models is None: | ||||
|             return "Provider not found", 404 | ||||
|         return models | ||||
|         return super().get_provider_models(provider, api_key, api_base, ignored) | ||||
|  | ||||
|     def _format_json(self, response_type: str, content = None, **kwargs) -> str: | ||||
|         """ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 hlohaus
					hlohaus