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

XFEstudio/gpt4free

fix: update session token parameter name in render function

30b07de8
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

2 个文件 +2 -14
Modified g4f/Provider/OllamaSwarm.py +1 -13
@@ -25,8 +25,7 @@ from pathlib import Path
25 25 from ..cookies import get_cookies_dir
26 26
27 27
28 # document.addEventListener('click', e=>{
29 # setTimeout(()=>{
28 # setInterval(()=>{
30 29 # window.urls = window.urls || JSON.parse(localStorage.getItem('urls')) || [];
31 30 # document.querySelectorAll('.hsxa-host a').forEach(e=>{
32 31 # if (!window.urls.includes(e.href)) {
@@ -36,7 +35,6 @@ from ..cookies import get_cookies_dir
36 35 # localStorage.setItem('urls', JSON.stringify(window.urls));
37 36 # console.log(window.urls.length);
38 37 # }, 1000);
39 # });
40 38
41 39 _DEFAULT_SEED_SERVERS = [
42 40 "http://116.202.111.94:11434",
@@ -397,15 +395,6 @@ def _get_cached_servers() -> list[str]:
397 395 debug.error(f"OllamaSwarm: failed to read cache: {e}")
398 396 return list(servers)
399 397
400 def _save_servers_to_cache(servers: list[str]) -> None:
401 try:
402 cache_file = get_cache_file()
403 cache_file.parent.mkdir(parents=True, exist_ok=True)
404 with open(cache_file, "w") as f:
405 json.dump(servers, f)
406 except Exception as e:
407 debug.error(f"OllamaSwarm: failed to save cache: {e}")
408
409 398 # ---------------------------------------------------------------------------
410 399 # FOFA discovery — free public API
411 400 # ---------------------------------------------------------------------------
@@ -479,7 +468,6 @@ def _probe_server(url: str) -> tuple[str, list[str]] | None:
479 468 for m in resp.json().get("models", [])
480 469 if "/attacker/" not in m.get("name", "")
481 470 and not m.get("name", "").startswith("model-b")
482 and "embed" not in m.get("name", "")
483 471 ]
484 472 if models:
485 473 return url, models
Modified g4f/gui/server/website.py +1 -1
@@ -33,7 +33,7 @@ def render(filename = "home", download_url: str = GITHUB_URL):
33 33 latest_version = version.utils.current_version
34 34 today = datetime.today().strftime('%Y-%m-%d')
35 35 cache_dir = os.path.join(get_cookies_dir(), ".gui_cache", today)
36 if not request.args.get("session_token"):
36 if not request.args.get("g4f_session"):
37 37 latest_version = str(latest_version) + quote(unquote(request.query_string.decode()))
38 38 cache_file = os.path.join(cache_dir, f"{secure_filename(f'{version.utils.current_version}-{latest_version}')}.{secure_filename(filename)}")
39 39 if os.path.isfile(cache_file + ".js"):