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

XFEstudio/gpt4free

Fix file descriptor leak in GUI render function

- Use context manager (with statement) to ensure file is properly closed - Prevents file descriptor exhaustion after ~10 page reloads - Fixes issue where web interface becomes unresponsive in Docker environments Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>

02e0bf02
copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
提交于

代码差异

1 个文件 +2 -1
Modified g4f/gui/server/website.py +2 -1
@@ -24,7 +24,8 @@ def render(filename = "home", download_url: str = GITHUB_URL):
24 24 path = os.path.abspath(os.path.join(os.path.dirname(DIST_DIR), filename))
25 25 if os.path.exists(path):
26 26 if download_url == GITHUB_URL:
27 html = open(path, 'r', encoding='utf-8').read()
27 with open(path, 'r', encoding='utf-8') as f:
28 html = f.read()
28 29 is_temp = True
29 30 else:
30 31 return send_from_directory(os.path.dirname(path), os.path.basename(path))