|
|
@@ -113,7 +113,7 @@ class FunctionKnowledge:
|
|
|
if cached_query:
|
|
|
logger.info(f"✓ 使用缓存的Query: {cached_query}")
|
|
|
# 记录缓存命中
|
|
|
- self.execution_detail["generate_query"].update({"cached": True, "query": cached_query})
|
|
|
+ self.execution_detail["generate_query"].update({"cached": True, "query": cached_query, "prompt": prompt})
|
|
|
return cached_query
|
|
|
|
|
|
logger.info("→ 调用Gemini生成Query...")
|
|
|
@@ -240,18 +240,6 @@ class FunctionKnowledge:
|
|
|
"""
|
|
|
logger.info(f"[步骤3] 提取工具参数...")
|
|
|
|
|
|
- # 尝试从缓存读取
|
|
|
- if self.use_cache:
|
|
|
- cached_params = self.cache.get(combined_question, 'function_knowledge', 'tool_params.json')
|
|
|
- if cached_params:
|
|
|
- logger.info(f"✓ 使用缓存的参数: {cached_params}")
|
|
|
- # 记录缓存命中
|
|
|
- self.execution_detail["extract_params"].update({
|
|
|
- "cached": True,
|
|
|
- "params": cached_params
|
|
|
- })
|
|
|
- return cached_params
|
|
|
-
|
|
|
try:
|
|
|
# 获取工具信息
|
|
|
tool_params = get_tool_params(tool_id)
|
|
|
@@ -265,6 +253,19 @@ class FunctionKnowledge:
|
|
|
query=query,
|
|
|
all_tool_params=tool_params
|
|
|
)
|
|
|
+
|
|
|
+ # 尝试从缓存读取
|
|
|
+ if self.use_cache:
|
|
|
+ cached_params = self.cache.get(combined_question, 'function_knowledge', 'tool_params.json')
|
|
|
+ if cached_params:
|
|
|
+ logger.info(f"✓ 使用缓存的参数: {cached_params}")
|
|
|
+ # 记录缓存命中
|
|
|
+ self.execution_detail["extract_params"].update({
|
|
|
+ "cached": True,
|
|
|
+ "params": cached_params,
|
|
|
+ "prompt": prompt,
|
|
|
+ })
|
|
|
+ return cached_params
|
|
|
|
|
|
# 调用LLM提取参数
|
|
|
logger.info(" → 调用Gemini提取参数...")
|
|
|
@@ -477,7 +478,7 @@ class FunctionKnowledge:
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
# 测试代码
|
|
|
- question = "教资查分这个信息怎么来的"
|
|
|
+ question = "教资查分这个选题点怎么来的"
|
|
|
post_info = "发帖时间:2025.11.07"
|
|
|
persona_info = ""
|
|
|
|