feat(chat): support public channel chat
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import AsyncIterator, Callable
|
||||
from contextvars import ContextVar
|
||||
import json
|
||||
|
||||
@@ -51,6 +52,17 @@ async def get_db():
|
||||
yield session
|
||||
|
||||
|
||||
DBFactory = Callable[[], AsyncIterator[AsyncSession]]
|
||||
|
||||
|
||||
async def get_db_factory() -> DBFactory:
|
||||
async def _factory() -> AsyncIterator[AsyncSession]:
|
||||
async with AsyncSession(engine) as session:
|
||||
yield session
|
||||
|
||||
return _factory
|
||||
|
||||
|
||||
# Redis 依赖
|
||||
def get_redis():
|
||||
return redis_client
|
||||
|
||||
Reference in New Issue
Block a user