Akarin~ 1cd60252b5
修复依赖注入问题? (#17)
* 实现缓存装饰器,优化数据获取和存储逻辑

* 重构代码,准备将聊天请求逻辑移入MarshoHandler

* 记录点(

* unfinished

* 🎨 重写基本完毕

* 移除未使用import,添加漏掉的换行

* 修复依赖注入问题?
2025-02-26 00:47:57 +08:00

35 lines
711 B
Python

from typing import TYPE_CHECKING, Any
from nonebot.adapters import Bot, Event
from nonebot.matcher import Matcher
from nonebot.typing import T_State
from pydantic import BaseModel
if TYPE_CHECKING:
from .caller import Caller
class SessionContext(BaseModel):
"""依赖注入会话上下文
Args:
BaseModel (_type_): _description_
"""
bot: Bot
event: Event
matcher: Matcher
state: T_State | None
caller: Any = None
class Config:
arbitrary_types_allowed = True
class SessionContextDepends(BaseModel):
bot: str | None = None
event: str | None = None
matcher: str | None = None
# state: str | None = None
caller: str | None = None