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

XFEstudio/gpt4free

Update merge tools

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

代码差异

10 个文件 +23 -13
Modified .gitignore +0 -1
@@ -10,7 +10,6 @@ pyvenv.cfg
10 10 lib64
11 11 /.idea
12 12 container/
13 g4f.dev
14 13 g4f.exe
15 14 har_and_cookies
16 15 playground
Deleted g4f-android-debug.apk +0 -0
二进制文件已变更,无法进行逐行预览。
Modified g4f/Provider/AgentTools.py +7 -3
@@ -214,9 +214,12 @@ def _merge_tool_call_fragments(accumulated: list, fragments: list) -> list:
214 214 if isinstance(fn, dict):
215 215 matched_fn = matched.setdefault("function", {})
216 216 if fn.get("name"):
217 matched_fn["name"] = (matched_fn.get("name") or "") + fn["name"]
218 if fn.get("arguments"):
219 matched_fn["arguments"] = (matched_fn.get("arguments") or "") + fn["arguments"]
217 matched_fn["name"] = fn.get("name")
218 if "arguments" in fn:
219 if fn["arguments"] == "":
220 matched_fn["arguments"] = fn["arguments"]
221 else:
222 matched_fn["arguments"] += fn["arguments"]
220 223 return accumulated
221 224
222 225 def _select_native_provider(inner_provider):
@@ -364,6 +367,7 @@ def _make_session(key, server, inner_provider, inner_model, loop_messages, kwarg
364 367 "done": False,
365 368 "error": None,
366 369 "created": time.time(),
370 "origin": os.environ.get("G4F_AGENT_ORIGIN"),
367 371 }
368 372
369 373 def _append_step_messages(session: dict, calls: list, tool_results: list, content: str) -> None:
Modified g4f/Provider/Pollinations.py +2 -1
@@ -416,7 +416,8 @@ class Pollinations(AsyncGeneratorProvider, ProviderModelMixin):
416 416 headers = {"authorization": f"Bearer {api_key}"}
417 417 async with ClientSession(
418 418 headers=DEFAULT_HEADERS,
419 connector=get_connector(proxy=proxy)
419 connector=get_connector(proxy=proxy),
420 timeout=ClientTimeout(),
420 421 ) as session:
421 422 responses = set()
422 423 yield Reasoning(
Modified g4f/client/service.py +1 -1
@@ -97,7 +97,7 @@ def get_model_and_provider(
97 97 if dynamic_model is not None:
98 98 model = dynamic_model
99 99
100 if not model:
100 if not model or model == "auto":
101 101 if has_images:
102 102 model = default_vision
103 103 provider = default_vision.best_provider
Modified g4f/config.py +3 -3
@@ -29,15 +29,15 @@ def get_config_dir() -> Path:
29 29
30 30 DEFAULT_PORT = 1337
31 31 DEFAULT_TIMEOUT = 600
32 DEFAULT_STREAM_TIMEOUT = 300
32 DEFAULT_STREAM_TIMEOUT = 600
33 33
34 34 PACKAGE_NAME = "g4f"
35 35 CONFIG_DIR = get_config_dir()
36 36 COOKIES_DIR = CONFIG_DIR / "cookies"
37 37 CUSTOM_COOKIES_DIR = "./har_and_cookies"
38 38 ORGANIZATION = "gpt4free"
39 GITHUB_REPOSITORY = f"xtekky/{ORGANIZATION}"
40 STATIC_DOMAIN = f"{PACKAGE_NAME}.dev"
39 GITHUB_REPOSITORY = f"xtekky/gpt4free"
40 STATIC_DOMAIN = f"g4f.dev"
41 41 STATIC_URL = f"https://{STATIC_DOMAIN}/"
42 42 REFFERER_URL = f"https://{STATIC_DOMAIN}/"
43 43 SPACE_URL = f"https://g4f.space/"
Modified g4f/gui/server/website.py +4 -1
@@ -49,8 +49,11 @@ def render(filename="home", download_url: str = GITHUB_URL):
49 49 with open(path, "r", encoding="utf-8") as f:
50 50 html = f.read()
51 51 return html.replace("{{ v }}", str(latest_version))
52 # Web app manifests must be re-fetched promptly, otherwise
53 # installability checks keep using a stale cached manifest.
54 max_age = 0 if path.endswith((".webmanifest", ".json")) else 31536000
52 55 return send_from_directory(
53 os.path.dirname(path), os.path.basename(path), max_age=31536000
56 os.path.dirname(path), os.path.basename(path), max_age=max_age
54 57 )
55 58 try:
56 59 latest_version = version.utils.latest_version
Modified g4f/mcp/tools.py +6 -0
@@ -1809,11 +1809,17 @@ class BrowserScreenshotTool(MCPTool):
1809 1809 capture = await session.call("Page.captureScreenshot", **params)
1810 1810 image_bytes = base64.b64decode(capture["data"])
1811 1811 filepath = _save_screenshot(image_bytes, state.get("url") or url)
1812 basename = os.path.basename(filepath)
1813 origin = arguments.get("origin")
1814 screenshot_url = f"{origin}/media/screenshots/{basename}" if origin else None
1812 1815 return {
1813 1816 "url": state.get("url") or url,
1814 1817 "title": state.get("title"),
1815 1818 "screenshot": filepath,
1816 1819 "fullPage": full_page,
1820 **({
1821 "screenshot_url": screenshot_url} if screenshot_url else {}
1822 )
1817 1823 }
1818 1824 except Exception as exc:
1819 1825 return {"error": f"Screenshot failed: {exc}"}
Modified g4f/requests/__init__.py +0 -1
@@ -288,7 +288,6 @@ def set_browser_executable_path(browser_executable_path: str):
288 288 async def get_nodriver(
289 289 proxy: str = None,
290 290 user_data_dir="nodriver",
291 timeout: int = 300,
292 291 browser_executable_path: str = None,
293 292 browser_args: list = None,
294 293 **kwargs,
Modified projects/android/app/src/main/python/bootstrap.py +0 -2
@@ -38,8 +38,6 @@ def main(app_root: str, port: int) -> None:
38 38 _log("creating GUI app ...")
39 39 app = g4f.gui.get_gui_app()
40 40 app.debug = False
41 app.timeout = 600
42 app.stream_timeout = 300
43 41
44 42 _log(f"serving on 127.0.0.1:{port}")
45 43 # Werkzeug dev server is fine for a local, single-user app.