feat: 向量记忆 RAG、工具市场、SSE 流式响应、前端集成与测试覆盖
- 新增 embedding_service(语义检索)、knowledge_service(RAG)、text_chunker、document_parser - 新增 tool_registry(自定义工具注册表)并完善工具市场 API(CRUD + code/http 执行) - 新增 agent_vector_memory / knowledge_base 模型及对应数据库表 - 实现 SSE 流式响应与 Agent 预算控制 - AgentChat.vue 集成 MainLayout 导航布局 - 完善测试体系:7 个新测试文件共 110 个测试覆盖 - 修复 conftest.py SQLite 内存数据库连接隔离问题 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1917,12 +1917,25 @@ class WorkflowEngine:
|
||||
if hasattr(self, '_on_tool_executed_budget'):
|
||||
_agent_on_tool = self._on_tool_executed_budget
|
||||
|
||||
# Agent 的 LLM 调用计入工作流预算
|
||||
def _on_agent_llm():
|
||||
self._llm_invocations += 1
|
||||
if self._llm_invocations > self._cap_llm:
|
||||
raise WorkflowExecutionError(
|
||||
detail=f"已超过 LLM 节点调用预算({self._cap_llm} 次)",
|
||||
)
|
||||
|
||||
result = await run_agent_node(
|
||||
node_data=node.get("data", {}),
|
||||
input_data=input_data,
|
||||
execution_logger=self.logger,
|
||||
user_id=self.trusted_model_config_user_id,
|
||||
on_tool_executed=_agent_on_tool,
|
||||
on_llm_invocation=_on_agent_llm,
|
||||
budget_limits={
|
||||
"max_llm_invocations": self._cap_llm,
|
||||
"max_tool_calls": self._cap_tool,
|
||||
},
|
||||
)
|
||||
if self.logger:
|
||||
duration = int((time.time() - start_time) * 1000)
|
||||
|
||||
Reference in New Issue
Block a user