mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-08 13:20:01 +08:00
♻️ refactor(core): 重构 AI 编排框架与记忆及 RAG 子系统 (#2149)
* ♻️ refactor(core): 重构 AI 编排框架与记忆及 RAG 子系统 - 【重构】重构 `BaseRunnable` 并引入统一的 `RunIntent` 意图载体,规范 Agent、Team 和 Workflow 的执行流 - 【解耦】将中期记忆槽和长期向量记忆从 `MemoryConfig` 中解耦,转为独立的能力组件与工具箱进行管理 - 【记忆】移除 `MemoryReader` 和 `MemoryWriter`,统一封装为 `SessionMemoryContext` 会话记忆门面 - 【RAG】重构检索器与存储后端接口,统一采用 `QueryRequest` 进行多维度联合检索,并引入 `InMemoryScorer` 提升打分性能 - 【事件】优化 `EventBus` 异步事件分发机制,引入队列机制确保事件按序处理,避免并发竞态问题 - 【依赖注入】移除 `memory` 注入项,优化 `DependencyInjector` 的签名解析缓存以提升性能 * 🚨 auto fix by pre-commit hooks --------- Co-authored-by: webjoin111 <455457521@qq.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
webjoin111
pre-commit-ci[bot]
parent
922d092650
commit
52f7dbdedf
@@ -4,7 +4,7 @@
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
import fnmatch
|
||||
from typing import TYPE_CHECKING, Any, Literal
|
||||
from typing import Any, Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
@@ -13,9 +13,6 @@ from zhenxun.services.ai.run.context import RunContext
|
||||
from zhenxun.services.ai.utils.logger import log_tool as logger
|
||||
from zhenxun.utils.pydantic_compat import model_dump, model_validate
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from zhenxun.services.ai.tools.core.tool import BaseTool
|
||||
|
||||
|
||||
class DirectivePayload(BaseModel):
|
||||
"""工具执行产生的副作用控制流指令载荷"""
|
||||
@@ -272,7 +269,7 @@ class Query(BaseModel):
|
||||
metadata_filter: dict[str, Any] | None = Field(default=None)
|
||||
"""如果提供,则工具的 metadata 必须包含这里列出的所有键值对。"""
|
||||
|
||||
def match(self, tool: "BaseTool") -> bool:
|
||||
def match(self, tool: Any) -> bool:
|
||||
"""判断某个工具或工具箱是否符合当前 Query 的筛选条件"""
|
||||
|
||||
def _match_pattern(val: str, pattern: str | list[str]) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user