1df49d1d6f
* stage * refactor: 重构 Function Tool 管理并引入 multi agent handsoff 机制 - Updated `star_request.py` to use the global `call_handler` instead of context-specific calls. - Modified `entities.py` to remove the dependency on `FunctionToolManager` and streamline the function tool handling. - Refactored `func_tool_manager.py` to simplify the `FunctionTool` class and its methods, removing deprecated code and enhancing clarity. - Adjusted `provider.py` to align with the new function tool structure, removing unnecessary type unions. - Enhanced `star_handler.py` to support agent registration and tool association, introducing `RegisteringAgent` for better encapsulation. - Updated `star_manager.py` to handle tool registration for agents, ensuring proper binding of handlers. - Revised `main.py` in the web searcher package to utilize the new agent registration system for web search tools. * chore: websearch * perf: 减少嵌套 * chore: 移除未使用的 mcp 导入
18 lines
453 B
Python
18 lines
453 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]
|