0b7fc29ac4
Co-authored-by: Dt8333 <25431943+Dt8333@users.noreply.github.com> Co-authored-by: Soulter <905617992@qq.com>
20 lines
455 B
Python
20 lines
455 B
Python
from dataclasses import dataclass
|
|
from typing import Any, Generic
|
|
|
|
from typing_extensions import TypeVar
|
|
|
|
from astrbot.core.platform.astr_message_event import AstrMessageEvent
|
|
|
|
TContext = TypeVar("TContext", default=Any)
|
|
|
|
|
|
@dataclass
|
|
class ContextWrapper(Generic[TContext]):
|
|
"""A context for running an agent, which can be used to pass additional data or state."""
|
|
|
|
context: TContext
|
|
event: AstrMessageEvent
|
|
|
|
|
|
NoContext = ContextWrapper[None]
|