新增渠道扩展框架的核心基础层,为所有渠道扩展提供统一的基础设施。 主要变更: - channel/extensions/__init__.py: 渠道扩展包初始化与注册 - channel/extensions/base.py: 渠道插件基类,定义统一接口规范 - channel_service.py: 渠道服务核心业务逻辑 - models_channels.py: 渠道相关数据库模型 - 8 个 channel_*_repo.py: 渠道数据仓库层 - storage/postgres/manager.py: 数据库管理器,新增渠道表 - models_business.py: 业务模型更新 - config/app.py: 应用配置更新 - conversation_repository.py: 会话仓库更新 - oidc_service.py: OIDC 服务更新 - logging_config.py: 日志配置更新
61 lines
1.3 KiB
Python
61 lines
1.3 KiB
Python
import logging
|
|
|
|
try:
|
|
from yuxi.channel.extensions import irc # noqa
|
|
except ImportError:
|
|
pass
|
|
|
|
try:
|
|
from yuxi.channel.extensions import nostr # noqa
|
|
except ImportError:
|
|
pass
|
|
|
|
try:
|
|
from yuxi.channel.extensions import wecom # noqa
|
|
except ImportError:
|
|
pass
|
|
|
|
try:
|
|
from yuxi.channel.extensions import activitypub # noqa
|
|
except ImportError:
|
|
pass
|
|
|
|
try:
|
|
from yuxi.channel.extensions import kuaishou # noqa
|
|
except ImportError:
|
|
pass
|
|
|
|
try:
|
|
from yuxi.channel.extensions import tencent_im # noqa
|
|
except ImportError:
|
|
pass
|
|
|
|
try:
|
|
from yuxi.channel.extensions import xiaohongshu # noqa
|
|
except ImportError:
|
|
pass
|
|
|
|
from yuxi.channel.plugins.registry import ChannelPluginRegistry
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def init_builtin_channels():
|
|
logger.info("Initializing built-in channel plugins...")
|
|
|
|
from yuxi.channel.plugins.discovery import run_discovery_pipeline
|
|
|
|
result = run_discovery_pipeline()
|
|
logger.info(
|
|
"Plugin discovery complete: %d discovered, %d skipped, %d errors",
|
|
sum(1 for d in result.discovered if not d.already_registered),
|
|
len(result.skipped),
|
|
len(result.errors),
|
|
)
|
|
|
|
plugins = ChannelPluginRegistry.list_all()
|
|
logger.info(
|
|
"Registered %d channel plugins: %s",
|
|
len(plugins),
|
|
[p.id for p in plugins],
|
|
) |