- Enhanced the HandleAssistantTags function to support multiple filtering options including type, connector, built-in status, mentionable status, automated status, and keywords. - Updated the GetAssistantTags method in the store interfaces to accept a filter parameter, allowing for more granular tag retrieval. - Refactored the Xun, Mongo, and Redis implementations of GetAssistantTags to utilize the new filtering capabilities. - Added comprehensive tests for the new filtering functionality, ensuring correct behavior across various scenarios. - Updated API endpoint documentation to reflect the new filtering options for assistant tags.
29 lines
1.2 KiB
Go
29 lines
1.2 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 assistants group with OAuth guard
|
|
assistants := group.Group("/assistants")
|
|
assistants.Use(oauth.Guard)
|
|
|
|
// Assistant CRUD - Standard REST endpoints
|
|
assistants.GET("/", ListAssistants) // GET /assistants - List assistants
|
|
assistants.POST("/", n.HandleAssistantSave) // POST /assistants - Create/Update assistant
|
|
assistants.GET("/tags", ListAssistantTags) // GET /assistants/tags - Get all assistant tags with permission filtering
|
|
assistants.GET("/:id", n.HandleAssistantDetail) // GET /assistants/:id - Get assistant details
|
|
assistants.DELETE("/:id", n.HandleAssistantDelete) // DELETE /assistants/:id - Delete assistant
|
|
|
|
// Assistant Actions
|
|
assistants.POST("/:id/call", n.HandleAssistantCall) // POST /assistants/:id/call - Execute assistant API
|
|
}
|