mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
Update render function to use latest_version for download URL and cache handling
This commit is contained in:
parent
24ebab640c
commit
9b4727b2f1
1 changed files with 3 additions and 3 deletions
|
|
@ -39,9 +39,9 @@ def render(filename = "home", download_url: str = DOWNLOAD_URL):
|
|||
is_temp = True
|
||||
else:
|
||||
os.makedirs(cache_dir, exist_ok=True)
|
||||
version = quote(unquote(request.query_string.decode())) or str(version.utils.current_version)
|
||||
latest_version = quote(unquote(request.query_string.decode())) or str(latest_version)
|
||||
if html is None:
|
||||
response = requests.get(f"{download_url}{filename}{'?' + version if version and download_url == DOWNLOAD_URL else ''}")
|
||||
response = requests.get(f"{download_url}{filename}{'?' + latest_version if latest_version and download_url == DOWNLOAD_URL else ''}")
|
||||
if not response.ok:
|
||||
found = None
|
||||
for root, _, files in os.walk(cache_dir):
|
||||
|
|
@ -57,7 +57,7 @@ def render(filename = "home", download_url: str = DOWNLOAD_URL):
|
|||
html = html.replace("../dist/", f"dist/")
|
||||
html = html.replace("\"dist/", f"\"{STATIC_URL}dist/")
|
||||
html = html.replace(JSDELIVR_URL, "/")
|
||||
html = html.replace("{{ v }}", version)
|
||||
html = html.replace("{{ v }}", latest_version)
|
||||
if is_temp:
|
||||
return html
|
||||
with open(cache_file, 'w', encoding='utf-8') as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue