package initialize import ( "aurora/middlewares" "github.com/gin-gonic/gin" ) func RegisterRouter() *gin.Engine { handler := NewHandle( checkProxy(), readAccessToken(), ) router := gin.Default() router.Use(middlewares.Cors) router.GET("/", func(c *gin.Context) { c.JSON(200, gin.H{ "message": "Hello, world!", }) }) router.GET("/ping", func(c *gin.Context) { c.JSON(200, gin.H{ "message": "pong", }) }) router.POST("/auth/session", handler.session) router.POST("/auth/refresh", handler.refresh) router.OPTIONS("/api/v1/chat/completions", optionsHandler) authGroup := router.Group("").Use(middlewares.Authorization) authGroup.POST("/api/v1/chat/completions", handler.duckduckgo) authGroup.GET("/api/v1/models", handler.engines) authGroup.POST("/backend-api/conversation", handler.chatgptConversation) return router }