from __future__ import annotations import logging from yuxi.channel.extensions.feishu.types import FeishuAccount logger = logging.getLogger(__name__) def resolve_enabled_tools(account: FeishuAccount) -> dict[str, bool]: return dict(account.tools) def is_tool_enabled(account: FeishuAccount, tool_name: str) -> bool: return account.tools.get(tool_name, False) def check_tool_per_group(account: FeishuAccount, chat_id: str, tool_name: str) -> bool: groups = account.groups if chat_id in groups: group_tools = groups[chat_id].get("tools", {}) if tool_name in group_tools: return group_tools[tool_name] return is_tool_enabled(account, tool_name) TOOL_DEPENDENCIES = { "wiki": ["doc"], }