From 618eabfe5c6018e5b217e8afb7a09dbe522c6274 Mon Sep 17 00:00:00 2001 From: Camreishi Date: Sun, 2 Feb 2025 13:25:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DGemini=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E8=B0=83=E7=94=A8=E6=97=B6=EF=BC=8Cparameters?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E5=AF=B9=E8=B1=A1=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #288 --- astrbot/core/provider/func_tool_manager.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/astrbot/core/provider/func_tool_manager.py b/astrbot/core/provider/func_tool_manager.py index 0c23e412c..efe2674cb 100644 --- a/astrbot/core/provider/func_tool_manager.py +++ b/astrbot/core/provider/func_tool_manager.py @@ -108,13 +108,19 @@ class FuncCall: for f in self.func_list: if not f.active: continue - tools.append( - { - "name": f.name, - "parameters": f.parameters, - "description": f.description, - } - ) + + func_declaration = { + "name": f.name, + "description": f.description + } + + # 检查并添加非空的properties参数 + params = f.parameters if isinstance(f.parameters, dict) else {} + if params.get("properties", {}): + func_declaration["parameters"] = params + + tools.append(func_declaration) + declarations["function_declarations"] = tools return declarations