返回提交历史
Modified
g4f/gui/server/website.py
+3
-2
XFEstudio/gpt4free
Update render function to include version in download URL and improve cache handling
bc77a922
代码差异
1 个文件
+3
-2
@@ -39,8 +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
43
if html is None:
43
response = requests.get(f"{download_url}{filename}")
44
response = requests.get(f"{download_url}{filename}{'?' + version if version and download_url == DOWNLOAD_URL else ''}")
44
45
if not response.ok:
45
46
found = None
46
47
for root, _, files in os.walk(cache_dir):
@@ -56,7 +57,7 @@ def render(filename = "home", download_url: str = DOWNLOAD_URL):
56
57
html = html.replace("../dist/", f"dist/")
57
58
html = html.replace("\"dist/", f"\"{STATIC_URL}dist/")
58
59
html = html.replace(JSDELIVR_URL, "/")
59
html = html.replace("{{ v }}", quote(unquote(request.query_string.decode())) or str(version.utils.current_version))
60
html = html.replace("{{ v }}", version)
60
61
if is_temp:
61
62
return html
62
63
with open(cache_file, 'w', encoding='utf-8') as f: