Remove deprecated studio package and refactor agent integration - Deleted the studio package, which is no longer in use, to streamline the codebase. - Updated references in the agent and chat modules to utilize the new agent package instead of the deprecated neo package. - Ensured that all related middleware and routing functionalities are now aligned with the agent architecture, enhancing overall system coherence.
29 lines
1.1 KiB
Go
29 lines
1.1 KiB
Go
package agent
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/yaoapp/yao/agent"
|
|
"github.com/yaoapp/yao/openapi/oauth/types"
|
|
)
|
|
|
|
// Attach attaches the agent (assistant) API handlers to the router with OAuth protection
|
|
// This provides OAuth-protected endpoints for assistant management, mirroring the agent assistant API
|
|
func Attach(group *gin.RouterGroup, oauth types.OAuth) {
|
|
|
|
// Get the Agent instance
|
|
n := agent.GetAgent()
|
|
|
|
// Create agents group with OAuth guard
|
|
agents := group.Group("/agents")
|
|
agents.Use(oauth.Guard)
|
|
|
|
// Agent CRUD - Standard REST endpoints
|
|
agents.GET("/", n.HandleAssistantList) // GET /agents - List agents
|
|
agents.POST("/", n.HandleAssistantSave) // POST /agents - Create/Update agent
|
|
agents.GET("/tags", n.HandleAssistantTags) // GET /agents/tags - Get all agent tags
|
|
agents.GET("/:id", n.HandleAssistantDetail) // GET /agents/:id - Get agent details
|
|
agents.DELETE("/:id", n.HandleAssistantDelete) // DELETE /agents/:id - Delete agent
|
|
|
|
// Agent Actions
|
|
agents.POST("/:id/call", n.HandleAssistantCall) // POST /agents/:id/call - Execute agent API
|
|
}
|