This commit is contained in:
2026-03-24 18:07:22 +08:00
parent e062368ef2
commit 9a16f738d8
121 changed files with 8904 additions and 3940 deletions
+12
View File
@@ -0,0 +1,12 @@
# Tools 模块
## 作用
提供可被 Agent 调用的工具实现。
## 文件
- `calculator.py`:计算器工具
- `rest_api_tool.py`:通用 REST 请求工具
- `sr_api_tool.py`:SR API SQL 查询工具
- `web_search.py`:Web 搜索工具
+13
View File
@@ -0,0 +1,13 @@
"""工具模块"""
from .calculator import CalculatorTool
from .sr_api_tool import SrApiQueryTool
from .rest_api_tool import RestApiTool
from .web_search import WebSearchTool
__all__ = [
"CalculatorTool",
"SrApiQueryTool",
"RestApiTool",
"WebSearchTool",
]
+6 -4
View File
@@ -25,14 +25,15 @@ class SrApiQueryTool(BaseTool):
sql = data.get("sql")
page = int(data.get("page", 1))
rows = int(data.get("rows", 10))
cfg = Config.get_section("sr_api")
default_rows = int(cfg.get("default_rows", 1000))
rows = int(data.get("rows", default_rows))
order_by_select = bool(data.get("orderBySelect", True))
timeout = float(data.get("timeout", 30))
if not sql:
return "缺少 sql"
cfg = Config.get_section("sr_api")
url = cfg.get("url")
app_key = cfg.get("llzappkey")
secret_key = cfg.get("llzsercret")
@@ -66,14 +67,15 @@ class SrApiQueryTool(BaseTool):
sql = data.get("sql")
page = int(data.get("page", 1))
rows = int(data.get("rows", 10))
cfg = Config.get_section("sr_api")
default_rows = int(cfg.get("default_rows", 1000))
rows = int(data.get("rows", default_rows))
order_by_select = bool(data.get("orderBySelect", True))
timeout = float(data.get("timeout", 30))
if not sql:
return "缺少 sql"
cfg = Config.get_section("sr_api")
url = cfg.get("url")
app_key = cfg.get("llzappkey")
secret_key = cfg.get("llzsercret")