init
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Tools 模块
|
||||
|
||||
## 作用
|
||||
|
||||
提供可被 Agent 调用的工具实现。
|
||||
|
||||
## 文件
|
||||
|
||||
- `calculator.py`:计算器工具
|
||||
- `rest_api_tool.py`:通用 REST 请求工具
|
||||
- `sr_api_tool.py`:SR API SQL 查询工具
|
||||
- `web_search.py`:Web 搜索工具
|
||||
@@ -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",
|
||||
]
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user