|
@@ -357,15 +357,15 @@ class FunctionKnowledge:
|
|
|
if cached_tool_call:
|
|
if cached_tool_call:
|
|
|
logger.info(f"✓ 使用缓存的工具调用结果")
|
|
logger.info(f"✓ 使用缓存的工具调用结果")
|
|
|
response = cached_tool_call.get('response', {})
|
|
response = cached_tool_call.get('response', {})
|
|
|
- # tool_result = self.organize_tool_result(response)
|
|
|
|
|
- # # 保存工具调用信息(包含工具名、入参、结果)
|
|
|
|
|
- # tool_call_data = {
|
|
|
|
|
- # "tool_name": tool_id,
|
|
|
|
|
- # "arguments": arguments,
|
|
|
|
|
- # "result": tool_result,
|
|
|
|
|
- # "response": response
|
|
|
|
|
- # }
|
|
|
|
|
- # self.cache.set(combined_question, 'function_knowledge', 'tool_call.json', tool_call_data)
|
|
|
|
|
|
|
+ tool_result = self.organize_tool_result(response)
|
|
|
|
|
+ # 保存工具调用信息(包含工具名、入参、结果)
|
|
|
|
|
+ tool_call_data = {
|
|
|
|
|
+ "tool_name": tool_id,
|
|
|
|
|
+ "arguments": arguments,
|
|
|
|
|
+ "result": tool_result,
|
|
|
|
|
+ "response": response
|
|
|
|
|
+ }
|
|
|
|
|
+ self.cache.set(combined_question, 'function_knowledge', 'tool_call.json', tool_call_data)
|
|
|
else:
|
|
else:
|
|
|
logger.info(f" → 调用工具,参数: {arguments}")
|
|
logger.info(f" → 调用工具,参数: {arguments}")
|
|
|
rs = call_tool(tool_id, arguments)
|
|
rs = call_tool(tool_id, arguments)
|
|
@@ -462,10 +462,10 @@ class FunctionKnowledge:
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
# 测试代码
|
|
# 测试代码
|
|
|
- question = "女儿的生日派对这个选题点怎么来的"
|
|
|
|
|
- post_info = "发帖时间:2025-09-16"
|
|
|
|
|
|
|
+ question = "教资查分这个选题点怎么来的"
|
|
|
|
|
+ post_info = "发帖时间:2025.11.07"
|
|
|
persona_info = ""
|
|
persona_info = ""
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
try:
|
|
try:
|
|
|
agent = FunctionKnowledge()
|
|
agent = FunctionKnowledge()
|
|
|
execution_result = agent.get_knowledge(question, post_info, persona_info)
|
|
execution_result = agent.get_knowledge(question, post_info, persona_info)
|