feat: Add web search functionality and enhance agent mode integration

- Introduced web search configuration in config.yaml, allowing multiple providers with specific settings.
- Updated InputField component to manage agent mode and web search toggles, improving user interaction.
- Enhanced chat API to include web search status in requests, enabling dynamic query handling.
- Implemented backend support for web search integration, merging results with knowledge base queries.
- Added tenant-level web search configuration management, allowing customization per tenant.
This commit is contained in:
wizardchen
2025-11-10 03:14:12 +08:00
parent 1313f4dfbb
commit 07a8c1de4c
46 changed files with 2574 additions and 56 deletions
+16
View File
@@ -40,6 +40,7 @@ type RouterParams struct {
InitializationHandler *handler.InitializationHandler
SystemHandler *handler.SystemHandler
MCPServiceHandler *handler.MCPServiceHandler
WebSearchHandler *handler.WebSearchHandler
}
// NewRouter 创建新的路由
@@ -87,6 +88,7 @@ func NewRouter(params RouterParams) *gin.Engine {
RegisterInitializationRoutes(v1, params.InitializationHandler)
RegisterSystemRoutes(v1, params.SystemHandler)
RegisterMCPServiceRoutes(v1, params.MCPServiceHandler)
RegisterWebSearchRoutes(v1, params.WebSearchHandler)
}
return r
@@ -224,6 +226,10 @@ func RegisterTenantRoutes(r *gin.RouterGroup, handler *handler.TenantHandler) {
// Tenant ID is obtained from authentication context
tenantRoutes.GET("/agent-config", handler.GetTenantAgentConfig)
tenantRoutes.PUT("/agent-config", handler.UpdateTenantAgentConfig)
// Web search configuration management (tenant-level)
// Tenant ID is obtained from authentication context
tenantRoutes.GET("/web-search-config", handler.GetTenantWebSearchConfig)
tenantRoutes.PUT("/web-search-config", handler.UpdateTenantWebSearchConfig)
}
}
@@ -319,3 +325,13 @@ func RegisterMCPServiceRoutes(r *gin.RouterGroup, handler *handler.MCPServiceHan
mcpServices.GET("/:id/resources", handler.GetMCPServiceResources)
}
}
// RegisterWebSearchRoutes registers web search routes
func RegisterWebSearchRoutes(r *gin.RouterGroup, webSearchHandler *handler.WebSearchHandler) {
// Web search providers
webSearch := r.Group("/web-search")
{
// Get available providers
webSearch.GET("/providers", webSearchHandler.GetProviders)
}
}