|
|
@@ -197,8 +197,11 @@ class FunctionKnowledge:
|
|
|
prompt = prompt_template.replace("{all_tool_infos}", all_tool_infos)
|
|
|
|
|
|
logger.info("→ 调用Gemini选择工具...")
|
|
|
- tool_name = generate_text(prompt=prompt)
|
|
|
- tool_name = tool_name.strip()
|
|
|
+ result = generate_text(prompt=prompt)
|
|
|
+ result_json = json.loads(result)
|
|
|
+ tool_name = result_json.get('工具名', '')
|
|
|
+ tool_mcp_name = result_json.get('工具调用ID', '')
|
|
|
+ tool_instructions = result_json.get('使用方法', '')
|
|
|
|
|
|
logger.info(f"✓ 选择结果: {tool_name}")
|
|
|
|