Skip to content

Commit 4b50bc1

Browse files
committed
fix(core): 重命名__dict__方法避免类型冲突将FunctionTool类的__dict__方法重命名为to_dict,修复Pylance报告的类型不兼容错误
1 parent 1e59225 commit 4b50bc1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

astrbot/core/agent/tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class FunctionTool:
3737
def __repr__(self) -> str:
3838
return f"FuncTool(name={self.name}, parameters={self.parameters}, description={self.description}, active={self.active}, origin={self.origin})"
3939

40-
def __dict__(self) -> dict[str, Any]:
40+
def to_dict(self) -> dict[str, Any]:
4141
"""将 FunctionTool 转换为字典格式"""
4242
return {
4343
"name": self.name,

astrbot/dashboard/routes/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ async def get_tool_list(self):
300300
"""获取所有注册的工具列表"""
301301
try:
302302
tools = self.tool_mgr.func_list
303-
tools_dict = [tool.__dict__() for tool in tools]
303+
tools_dict = [tool.to_dict() for tool in tools]
304304
return Response().ok(data=tools_dict).__dict__
305305
except Exception as e:
306306
logger.error(traceback.format_exc())

0 commit comments

Comments
 (0)