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

XFEstudio/gpt4free

Some bug fixes

14743a52
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

3 个文件 +8 -4
Modified g4f/Provider/Pollinations.py +2 -2
@@ -367,9 +367,9 @@ class Pollinations(AsyncGeneratorProvider, ProviderModelMixin):
367 367 def get_url_with_seed(i: int, seed: Optional[int] = None):
368 368 if i == 0:
369 369 if not cache and seed is None:
370 seed = random.randint(0, 2 ** 32)
370 seed = random.randint(0, int(2e9))
371 371 else:
372 seed = random.randint(0, 2 ** 32)
372 seed = random.randint(0, int(2e9))
373 373 return f"{url}&seed={seed}" if seed else url
374 374
375 375 headers = None
Modified g4f/mcp/tools.py +5 -1
@@ -822,7 +822,11 @@ class CreateFileTool(MCPTool):
822 822 return {"error": f"File already exists: {rel_path}. Use FileWriteTool to overwrite."}
823 823 target.parent.mkdir(parents=True, exist_ok=True)
824 824 target.write_text(content, encoding="utf-8")
825 return {"filePath": rel_path, "created": True, "size": len(content)}
825 result: Dict[str, Any] = {"filePath": rel_path, "created": True, "size": len(content)}
826 origin = arguments.get("origin")
827 if origin:
828 result["url"] = f"{origin}/pa/files/{rel_path}"
829 return result
826 830 except Exception as exc:
827 831 return {"error": f"Create file failed: {exc}"}
828 832
Modified g4f/requests/cdp.py +1 -1
@@ -626,7 +626,7 @@ class SyncCDPSession:
626 626 result = await asyncio.get_event_loop().run_in_executor(None, run_sync)
627 627 """
628 628
629 def __init__(self, port: Optional[int] = None, host: str = '127.0.0.1', user_data_dir: Optional[str] = None, headless: bool = False):
629 def __init__(self, port: Optional[int] = None, host: Optional[str] = None, user_data_dir: Optional[str] = None, headless: bool = False):
630 630 if port is None:
631 631 port = BrowserConfig.port
632 632 if host is None: