初步实现Route Agent

This commit is contained in:
asypost committed 2026-11-06 21:03:50 +08:00
1 parent 77ff26094d
commit c7274f6f00
12 files changed
+681 -251

No files matched your search

+3 -2
View File
@@ -6,6 +6,7 @@ from mini_agent.tools.tool import Tool
class ConversationContext(BaseModel):
conversation_id: str = Field(description="会话ID")
run_id: str = Field(description="当前会话轮id")
messages: list[ChatCompletionMessageParam] = Field(description="消息历史", default_factory=list)
_discovered_tools: list[Tool] = PrivateAttr(default_factory=list)
@@ -17,6 +18,6 @@ class ConversationContext(BaseModel):
return self._discovered_tools
def add_tool(self, tool: Tool):
if tool.name not in self.discovered_tool_names:
self.discovered_tool_names.append(tool.name)
if tool.id not in self.discovered_tool_names:
self.discovered_tool_names.append(tool.id)
self.discovered_tools.append(tool)