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

XFEstudio/gpt4free

Update render function to use latest_version for download URL and cache handling

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

代码差异

1 个文件 +3 -3
Modified g4f/gui/server/website.py +3 -3
@@ -39,9 +39,9 @@ def render(filename = "home", download_url: str = DOWNLOAD_URL):
39 39 is_temp = True
40 40 else:
41 41 os.makedirs(cache_dir, exist_ok=True)
42 version = quote(unquote(request.query_string.decode())) or str(version.utils.current_version)
42 latest_version = quote(unquote(request.query_string.decode())) or str(latest_version)
43 43 if html is None:
44 response = requests.get(f"{download_url}{filename}{'?' + version if version and download_url == DOWNLOAD_URL else ''}")
44 response = requests.get(f"{download_url}{filename}{'?' + latest_version if latest_version and download_url == DOWNLOAD_URL else ''}")
45 45 if not response.ok:
46 46 found = None
47 47 for root, _, files in os.walk(cache_dir):
@@ -57,7 +57,7 @@ def render(filename = "home", download_url: str = DOWNLOAD_URL):
57 57 html = html.replace("../dist/", f"dist/")
58 58 html = html.replace("\"dist/", f"\"{STATIC_URL}dist/")
59 59 html = html.replace(JSDELIVR_URL, "/")
60 html = html.replace("{{ v }}", version)
60 html = html.replace("{{ v }}", latest_version)
61 61 if is_temp:
62 62 return html
63 63 with open(cache_file, 'w', encoding='utf-8') as f: