Merge branch 'custom_agent'
This commit is contained in:
@@ -47,6 +47,7 @@ type RouterParams struct {
|
||||
WebSearchHandler *handler.WebSearchHandler
|
||||
FAQHandler *handler.FAQHandler
|
||||
TagHandler *handler.TagHandler
|
||||
CustomAgentHandler *handler.CustomAgentHandler
|
||||
}
|
||||
|
||||
// NewRouter 创建新的路由
|
||||
@@ -110,6 +111,7 @@ func NewRouter(params RouterParams) *gin.Engine {
|
||||
RegisterSystemRoutes(v1, params.SystemHandler)
|
||||
RegisterMCPServiceRoutes(v1, params.MCPServiceHandler)
|
||||
RegisterWebSearchRoutes(v1, params.WebSearchHandler)
|
||||
RegisterCustomAgentRoutes(v1, params.CustomAgentHandler)
|
||||
}
|
||||
|
||||
return r
|
||||
@@ -412,3 +414,24 @@ func RegisterWebSearchRoutes(r *gin.RouterGroup, webSearchHandler *handler.WebSe
|
||||
webSearch.GET("/providers", webSearchHandler.GetProviders)
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterCustomAgentRoutes registers custom agent routes
|
||||
func RegisterCustomAgentRoutes(r *gin.RouterGroup, agentHandler *handler.CustomAgentHandler) {
|
||||
agents := r.Group("/agents")
|
||||
{
|
||||
// Get placeholder definitions (must be before /:id to avoid conflict)
|
||||
agents.GET("/placeholders", agentHandler.GetPlaceholders)
|
||||
// Create custom agent
|
||||
agents.POST("", agentHandler.CreateAgent)
|
||||
// List all agents (including built-in)
|
||||
agents.GET("", agentHandler.ListAgents)
|
||||
// Get agent by ID
|
||||
agents.GET("/:id", agentHandler.GetAgent)
|
||||
// Update agent
|
||||
agents.PUT("/:id", agentHandler.UpdateAgent)
|
||||
// Delete agent
|
||||
agents.DELETE("/:id", agentHandler.DeleteAgent)
|
||||
// Copy agent
|
||||
agents.POST("/:id/copy", agentHandler.CopyAgent)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user