mirror of
https://github.com/FuQuan233/nonebot-plugin-llmchat.git
synced 2026-02-05 11:38:05 +00:00
✨ 合并私聊指令,更新相关权限和状态管理
This commit is contained in:
parent
302748db36
commit
a06be797f5
1 changed files with 6 additions and 5 deletions
|
|
@ -108,7 +108,7 @@ class MCPClient:
|
||||||
|
|
||||||
return SessionContext()
|
return SessionContext()
|
||||||
|
|
||||||
async def get_available_tools(self):
|
async def get_available_tools(self, is_group: bool):
|
||||||
"""获取可用工具列表,使用缓存机制"""
|
"""获取可用工具列表,使用缓存机制"""
|
||||||
if self._tools_cache is not None:
|
if self._tools_cache is not None:
|
||||||
logger.debug("返回缓存的工具列表")
|
logger.debug("返回缓存的工具列表")
|
||||||
|
|
@ -117,10 +117,11 @@ class MCPClient:
|
||||||
logger.info(f"初始化工具列表缓存,需要连接{len(self.server_config)}个服务器")
|
logger.info(f"初始化工具列表缓存,需要连接{len(self.server_config)}个服务器")
|
||||||
available_tools = []
|
available_tools = []
|
||||||
|
|
||||||
# 添加OneBot内置工具
|
if is_group:
|
||||||
onebot_tools = self.onebot_tools.get_available_tools()
|
# 添加OneBot内置工具,仅在群聊中可用
|
||||||
available_tools.extend(onebot_tools)
|
onebot_tools = self.onebot_tools.get_available_tools()
|
||||||
logger.debug(f"添加了{len(onebot_tools)}个OneBot内置工具")
|
available_tools.extend(onebot_tools)
|
||||||
|
logger.debug(f"添加了{len(onebot_tools)}个OneBot内置工具")
|
||||||
|
|
||||||
# 添加自定义工具(可选)
|
# 添加自定义工具(可选)
|
||||||
# if hasattr(self, 'custom_tools'):
|
# if hasattr(self, 'custom_tools'):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue