mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-08-01 07:09:50 +00:00
✨ 添加依赖注入支持,重构函数调用上下文,优化插件加载机制
This commit is contained in:
34
nonebot_plugin_marshoai/plugin/func_call/models.py
Normal file
34
nonebot_plugin_marshoai/plugin/func_call/models.py
Normal file
@ -0,0 +1,34 @@
|
||||
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
|
||||
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
|
Reference in New Issue
Block a user