feat:合并工具调用模型和心流模型

This commit is contained in:
SengokuCola
2025-04-24 14:18:41 +08:00
parent 2871e4efc2
commit f8450f705a
22 changed files with 973 additions and 331 deletions

View File

@@ -41,12 +41,11 @@ class BaseTool:
"function": {"name": cls.name, "description": cls.description, "parameters": cls.parameters},
}
async def execute(self, function_args: Dict[str, Any], message_txt: str = "") -> Dict[str, Any]:
async def execute(self, function_args: Dict[str, Any]) -> Dict[str, Any]:
"""执行工具函数
Args:
function_args: 工具调用参数
message_txt: 原始消息文本
Returns:
Dict: 工具执行结果

View File

@@ -19,7 +19,7 @@ class CompareNumbersTool(BaseTool):
"required": ["num1", "num2"],
}
async def execute(self, function_args: Dict[str, Any], message_txt: str = "") -> Dict[str, Any]:
async def execute(self, function_args: Dict[str, Any]) -> Dict[str, Any]:
"""执行比较两个数的大小
Args:

View File

@@ -21,7 +21,7 @@ class SearchKnowledgeTool(BaseTool):
"required": ["query"],
}
async def execute(self, function_args: Dict[str, Any], message_txt: str = "") -> Dict[str, Any]:
async def execute(self, function_args: Dict[str, Any]) -> Dict[str, Any]:
"""执行知识库搜索
Args:
@@ -32,7 +32,7 @@ class SearchKnowledgeTool(BaseTool):
Dict: 工具执行结果
"""
try:
query = function_args.get("query", message_txt)
query = function_args.get("query")
threshold = function_args.get("threshold", 0.4)
# 调用知识库搜索

View File

@@ -20,7 +20,7 @@ class GetMemoryTool(BaseTool):
"required": ["topic"],
}
async def execute(self, function_args: Dict[str, Any], message_txt: str = "") -> Dict[str, Any]:
async def execute(self, function_args: Dict[str, Any]) -> Dict[str, Any]:
"""执行记忆获取
Args:
@@ -31,7 +31,7 @@ class GetMemoryTool(BaseTool):
Dict: 工具执行结果
"""
try:
topic = function_args.get("topic", message_txt)
topic = function_args.get("topic")
max_memory_num = function_args.get("max_memory_num", 2)
# 将主题字符串转换为列表

View File

@@ -17,7 +17,7 @@ class GetCurrentDateTimeTool(BaseTool):
"required": [],
}
async def execute(self, function_args: Dict[str, Any], message_txt: str = "") -> Dict[str, Any]:
async def execute(self, function_args: Dict[str, Any]) -> Dict[str, Any]:
"""执行获取当前时间、日期、年份和星期
Args:

View File

@@ -24,7 +24,7 @@ class SearchKnowledgeFromLPMMTool(BaseTool):
"required": ["query"],
}
async def execute(self, function_args: Dict[str, Any], message_txt: str = "") -> Dict[str, Any]:
async def execute(self, function_args: Dict[str, Any]) -> Dict[str, Any]:
"""执行知识库搜索
Args:
@@ -35,7 +35,7 @@ class SearchKnowledgeFromLPMMTool(BaseTool):
Dict: 工具执行结果
"""
try:
query = function_args.get("query", message_txt)
query = function_args.get("query")
# threshold = function_args.get("threshold", 0.4)
# 调用知识库搜索