PMFlow/backend/app/services/feishu_integration_service/service.py

52 lines
1.5 KiB
Python

from __future__ import annotations
from .mixin_config import FeishuConfigMixin
from .mixin_message_payload import FeishuMessagePayloadMixin
from .mixin_receive import FeishuReceiveMixin
from .mixin_receive_routing import FeishuReceiveRoutingMixin
from .mixin_reply_guard import FeishuReplyGuardMixin
from .mixin_reply_outbox import FeishuReplyOutboxMixin
from .mixin_reply_llm_core import FeishuReplyLLMCoreMixin
from .mixin_reply_templates import FeishuReplyTemplatesMixin
from .mixin_sender_resolution import FeishuSenderResolutionMixin
from .mixin_trace import FeishuTraceMixin
from .mixin_transport import FeishuTransportMixin
from .shared import AsyncSession
class FeishuIntegrationService(
FeishuConfigMixin,
FeishuReceiveMixin,
FeishuReceiveRoutingMixin,
FeishuTraceMixin,
FeishuReplyLLMCoreMixin,
FeishuReplyTemplatesMixin,
FeishuReplyOutboxMixin,
FeishuReplyGuardMixin,
FeishuSenderResolutionMixin,
FeishuMessagePayloadMixin,
FeishuTransportMixin,
):
"""飞书集成服务。"""
# 全局服务实例
_feishu_service = None
async def dispatch_pending_feishu_replies(limit: int = 30) -> int:
"""后台补偿发送:扫描 pending/retrying outbox 并触发派发。"""
return await FeishuIntegrationService.dispatch_pending_outbox_entries(limit=limit)
def get_feishu_service(db: AsyncSession) -> FeishuIntegrationService:
"""获取飞书服务实例。"""
return FeishuIntegrationService(db)
__all__ = [
"FeishuIntegrationService",
"dispatch_pending_feishu_replies",
"get_feishu_service",
]