feat(database): enhance DatabaseQueryTool with search scope filtering

- Updated DatabaseQueryTool to accept search targets during initialization.
- Implemented search scope filtering in SQL validation to restrict queries to specified knowledge bases and documents.
- Enhanced the SQL validation process to include new filtering options for improved security and query accuracy.
This commit is contained in:
wizardchen
2026-03-31 10:32:38 +08:00
committed by lyingbug
parent bfd47b079f
commit 1f01183057
3 changed files with 87 additions and 6 deletions
@@ -395,7 +395,7 @@ func (s *agentService) registerTools(
case tools.ToolGetDocumentInfo:
toolToRegister = tools.NewGetDocumentInfoTool(s.knowledgeService, s.chunkService, config.SearchTargets)
case tools.ToolDatabaseQuery:
toolToRegister = tools.NewDatabaseQueryTool(s.db)
toolToRegister = tools.NewDatabaseQueryTool(s.db, config.SearchTargets)
case tools.ToolWebSearch:
toolToRegister = tools.NewWebSearchTool(
s.webSearchService,