feat(gateway): register all tools in SessionManager
- Register FileReadTool, FileWriteTool, FileEditTool, BashTool - Register HttpRequestTool with allow-all domains for testing - Register WebFetchTool - CalculatorTool already registered
This commit is contained in:
parent
b13bb8c556
commit
98bc9739c6
@ -7,7 +7,10 @@ use crate::bus::ChatMessage;
|
|||||||
use crate::config::LLMProviderConfig;
|
use crate::config::LLMProviderConfig;
|
||||||
use crate::agent::{AgentLoop, AgentError};
|
use crate::agent::{AgentLoop, AgentError};
|
||||||
use crate::protocol::WsOutbound;
|
use crate::protocol::WsOutbound;
|
||||||
use crate::tools::{CalculatorTool, ToolRegistry};
|
use crate::tools::{
|
||||||
|
BashTool, CalculatorTool, FileEditTool, FileReadTool, FileWriteTool,
|
||||||
|
HttpRequestTool, ToolRegistry, WebFetchTool,
|
||||||
|
};
|
||||||
|
|
||||||
/// Session 按 channel 隔离,每个 channel 一个 Session
|
/// Session 按 channel 隔离,每个 channel 一个 Session
|
||||||
/// History 按 chat_id 隔离,由 Session 统一管理
|
/// History 按 chat_id 隔离,由 Session 统一管理
|
||||||
@ -114,6 +117,17 @@ struct SessionManagerInner {
|
|||||||
fn default_tools() -> ToolRegistry {
|
fn default_tools() -> ToolRegistry {
|
||||||
let mut registry = ToolRegistry::new();
|
let mut registry = ToolRegistry::new();
|
||||||
registry.register(CalculatorTool::new());
|
registry.register(CalculatorTool::new());
|
||||||
|
registry.register(FileReadTool::new());
|
||||||
|
registry.register(FileWriteTool::new());
|
||||||
|
registry.register(FileEditTool::new());
|
||||||
|
registry.register(BashTool::new());
|
||||||
|
registry.register(HttpRequestTool::new(
|
||||||
|
vec!["*".to_string()], // 允许所有域名,实际使用时建议限制
|
||||||
|
1_000_000, // max_response_size
|
||||||
|
30, // timeout_secs
|
||||||
|
false, // allow_private_hosts
|
||||||
|
));
|
||||||
|
registry.register(WebFetchTool::new(50_000, 30)); // max_chars, timeout_secs
|
||||||
registry
|
registry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user