本次提交新增了完整的多渠道消息网关系统,包括: 1. 支持飞书、钉钉、Web、Hook 四种渠道的适配器与配置 2. 领域模型层:消息、会话、绑定、出箱等核心实体 3. 应用服务层:管道、中间件、DTO 与业务逻辑 4. 基础设施层:持久化、过滤器、队列等端口实现 5. 接口层:REST API、SSE、WebSocket 通信端点 6. 前端页面与路由配置,添加渠道管理菜单 7. 新增相关依赖包与 docker-compose 部署配置
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from yuxi.channel.domain.model.binding.channel_binding import ChannelBinding
|
|
from yuxi.channel.domain.repository.binding_repository import BindingRepositoryPort
|
|
|
|
|
|
class BindingService:
|
|
def __init__(self, binding_repo: BindingRepositoryPort) -> None:
|
|
self._repo = binding_repo
|
|
|
|
async def create(
|
|
self,
|
|
*,
|
|
channel_type: str,
|
|
account_id: str,
|
|
group_id: str,
|
|
agent_config_id: int,
|
|
) -> ChannelBinding:
|
|
return await self._repo.create_binding(
|
|
channel_type=channel_type,
|
|
account_id=account_id,
|
|
group_id=group_id,
|
|
agent_config_id=agent_config_id,
|
|
)
|
|
|
|
async def delete(self, binding_id: int) -> bool:
|
|
return await self._repo.delete_binding(binding_id)
|
|
|
|
async def get(self, binding_id: int) -> ChannelBinding | None:
|
|
return await self._repo.get_binding(binding_id)
|
|
|
|
async def list(
|
|
self, *, channel_type: str | None = None, offset: int = 0, limit: int = 50
|
|
) -> tuple[list[ChannelBinding], int]:
|
|
return await self._repo.list_bindings(channel_type=channel_type, offset=offset, limit=limit)
|