|
@@ -2154,7 +2154,7 @@ async def browser_load_cookies(url: str, name: str = "", auto_navigate: bool = T
|
|
|
# ============================================================
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_navigate(url: str, new_tab: bool = False) -> ToolResult:
|
|
async def browser_navigate(url: str, new_tab: bool = False) -> ToolResult:
|
|
|
"""
|
|
"""
|
|
|
导航到指定 URL。
|
|
导航到指定 URL。
|
|
@@ -2166,7 +2166,7 @@ async def browser_navigate(url: str, new_tab: bool = False) -> ToolResult:
|
|
|
return await browser_navigate_to_url(url=url, new_tab=new_tab)
|
|
return await browser_navigate_to_url(url=url, new_tab=new_tab)
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_search(query: str, engine: str = "bing") -> ToolResult:
|
|
async def browser_search(query: str, engine: str = "bing") -> ToolResult:
|
|
|
"""
|
|
"""
|
|
|
使用搜索引擎搜索。
|
|
使用搜索引擎搜索。
|
|
@@ -2178,13 +2178,13 @@ async def browser_search(query: str, engine: str = "bing") -> ToolResult:
|
|
|
return await browser_search_web(query=query, engine=engine)
|
|
return await browser_search_web(query=query, engine=engine)
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_back() -> ToolResult:
|
|
async def browser_back() -> ToolResult:
|
|
|
"""返回上一页。"""
|
|
"""返回上一页。"""
|
|
|
return await browser_go_back()
|
|
return await browser_go_back()
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_interact(
|
|
async def browser_interact(
|
|
|
action: Literal["click", "type", "send_keys", "upload", "dropdown_list", "dropdown_select"],
|
|
action: Literal["click", "type", "send_keys", "upload", "dropdown_list", "dropdown_select"],
|
|
|
index: Optional[int] = None,
|
|
index: Optional[int] = None,
|
|
@@ -2245,7 +2245,7 @@ async def browser_interact(
|
|
|
return ToolResult(title="未知 action", output="", error=f"不支持的 action: {action}")
|
|
return ToolResult(title="未知 action", output="", error=f"不支持的 action: {action}")
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_scroll(
|
|
async def browser_scroll(
|
|
|
down: bool = True,
|
|
down: bool = True,
|
|
|
pages: float = 1.0,
|
|
pages: float = 1.0,
|
|
@@ -2262,7 +2262,7 @@ async def browser_scroll(
|
|
|
return await browser_scroll_page(down=down, pages=pages, index=into_view_index)
|
|
return await browser_scroll_page(down=down, pages=pages, index=into_view_index)
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_screenshot(highlight_elements: bool = False) -> ToolResult:
|
|
async def browser_screenshot(highlight_elements: bool = False) -> ToolResult:
|
|
|
"""
|
|
"""
|
|
|
截取当前页面。
|
|
截取当前页面。
|
|
@@ -2277,7 +2277,7 @@ async def browser_screenshot(highlight_elements: bool = False) -> ToolResult:
|
|
|
return await browser_screenshot_impl()
|
|
return await browser_screenshot_impl()
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_elements() -> ToolResult:
|
|
async def browser_elements() -> ToolResult:
|
|
|
"""
|
|
"""
|
|
|
获取当前页面的可交互元素列表(纯文本,不截图)。
|
|
获取当前页面的可交互元素列表(纯文本,不截图)。
|
|
@@ -2286,7 +2286,7 @@ async def browser_elements() -> ToolResult:
|
|
|
return await browser_get_selector_map()
|
|
return await browser_get_selector_map()
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_read(
|
|
async def browser_read(
|
|
|
mode: Literal["html", "find", "long"],
|
|
mode: Literal["html", "find", "long"],
|
|
|
query: Optional[str] = None,
|
|
query: Optional[str] = None,
|
|
@@ -2325,7 +2325,7 @@ async def browser_read(
|
|
|
return ToolResult(title="未知 mode", output="", error=f"不支持的 mode: {mode}")
|
|
return ToolResult(title="未知 mode", output="", error=f"不支持的 mode: {mode}")
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_extract(
|
|
async def browser_extract(
|
|
|
query: str,
|
|
query: str,
|
|
|
extract_links: bool = False,
|
|
extract_links: bool = False,
|
|
@@ -2349,7 +2349,7 @@ async def browser_extract(
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_tabs(
|
|
async def browser_tabs(
|
|
|
action: Literal["switch", "close"],
|
|
action: Literal["switch", "close"],
|
|
|
tab_id: str = "",
|
|
tab_id: str = "",
|
|
@@ -2372,7 +2372,7 @@ async def browser_tabs(
|
|
|
return ToolResult(title="未知 action", output="", error=f"不支持的 action: {action}")
|
|
return ToolResult(title="未知 action", output="", error=f"不支持的 action: {action}")
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_cookies(
|
|
async def browser_cookies(
|
|
|
action: Literal["load", "export", "ensure_login"],
|
|
action: Literal["load", "export", "ensure_login"],
|
|
|
url: str = "",
|
|
url: str = "",
|
|
@@ -2416,7 +2416,7 @@ async def browser_cookies(
|
|
|
return ToolResult(title="未知 action", output="", error=f"不支持的 action: {action}")
|
|
return ToolResult(title="未知 action", output="", error=f"不支持的 action: {action}")
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_wait(
|
|
async def browser_wait(
|
|
|
seconds: Optional[int] = None,
|
|
seconds: Optional[int] = None,
|
|
|
user_message: Optional[str] = None,
|
|
user_message: Optional[str] = None,
|
|
@@ -2441,7 +2441,7 @@ async def browser_wait(
|
|
|
return await browser_wait_impl(seconds=seconds or 3)
|
|
return await browser_wait_impl(seconds=seconds or 3)
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_js(code: str) -> ToolResult:
|
|
async def browser_js(code: str) -> ToolResult:
|
|
|
"""
|
|
"""
|
|
|
在当前页面执行 JavaScript 代码。
|
|
在当前页面执行 JavaScript 代码。
|
|
@@ -2452,7 +2452,7 @@ async def browser_js(code: str) -> ToolResult:
|
|
|
return await browser_evaluate(code=code)
|
|
return await browser_evaluate(code=code)
|
|
|
|
|
|
|
|
|
|
|
|
|
-@tool()
|
|
|
|
|
|
|
+@tool(groups=["browser"])
|
|
|
async def browser_download(url: str, save_name: str = "") -> ToolResult:
|
|
async def browser_download(url: str, save_name: str = "") -> ToolResult:
|
|
|
"""
|
|
"""
|
|
|
下载指定 URL 的文件到本地。
|
|
下载指定 URL 的文件到本地。
|