ForcePilot/backend/package/yuxi/channel/extensions/feishu/tools_config.py
Kris 5e91bb9985 feat(feishu): 新增飞书渠道完整插件实现
新增飞书渠道插件,包含基础配置、事件处理、消息收发、工具调用、权限管理等完整功能模块,支持WebSocket长连接、卡片消息、流式响应、群管理、审批通知等能力
2026-05-21 10:46:42 +08:00

29 lines
745 B
Python

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"],
}