XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

fix: improve error messaging and handling in get_provider_models

- Updated error message formatting in `get_provider_models` call within `Backend_Api` class - Changed `MissingAuthError` handling to include exception type name in response - Added generic `Exception` catch to handle unexpected errors with HTTP 500 response - Modified `backend_api.py` file in `g4f/gui/server` directory - Ensured all returned error messages use consistent structure with exception type and message

f246e7cf
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

1 个文件 +3 -1
Modified g4f/gui/server/backend_api.py +3 -1
@@ -123,7 +123,9 @@ class Backend_Api(Api):
123 123 try:
124 124 response = self.get_provider_models(**kwargs)
125 125 except MissingAuthError as e:
126 return jsonify({"error": {"message": str(e)}}), 401
126 return jsonify({"error": {"message": f"{type(e).__name__}: {e}"}}), 401
127 except Exception as e:
128 return jsonify({"error": {"message": f"{type(e).__name__}: {e}"}}), 500
127 129 return jsonify(response)
128 130
129 131 @app.route('/backend-api/v2/providers', methods=['GET'])