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

XFEstudio/gpt4free

Fix create_app function to accept compress parameter and update GUI app initialization

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

代码差异

2 个文件 +4 -2
Modified g4f/gui/__init__.py +1 -1
@@ -11,7 +11,7 @@ except ImportError as e:
11 11 def get_gui_app(demo: bool = False, timeout: int = None, stream_timeout: int = None):
12 12 if import_error is not None:
13 13 raise MissingRequirementsError(f'Install "gui" requirements | pip install -U g4f[gui]\n{import_error}')
14 app = create_app()
14 app = create_app(False)
15 15 app.demo = demo
16 16 app.timeout = timeout
17 17 app.stream_timeout = stream_timeout
Modified g4f/gui/server/app.py +3 -1
@@ -1,11 +1,13 @@
1 1 import gzip
2 2 from flask import Flask, request
3 3
4 def create_app() -> Flask:
4 def create_app(compress: bool = True) -> Flask:
5 5 app = Flask(__name__)
6 6
7 7 @app.after_request
8 8 def compress_response(response):
9 if not compress:
10 return response
9 11 accept_encoding = request.headers.get('Accept-Encoding', '')
10 12 if 'gzip' not in accept_encoding.lower():
11 13 return response