Jddjbddb's picture
Update initialize/router.go
a3a6081 verified
raw
history blame contribute delete
721 Bytes
package initialize
import (
"aurora/middlewares"
"github.com/gin-gonic/gin"
)
func RegisterRouter() *gin.Engine {
handler := NewHandle(
checkProxy(),
)
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.OPTIONS("api/v1/chat/completions", optionsHandler)
router.OPTIONS("api/v1/chat/models", optionsHandler)
authGroup := router.Group("").Use(middlewares.Authorization)
authGroup.POST("api/v1/chat/completions", handler.duckduckgo)
authGroup.GET("api/v1/models", handler.engines)
return router
}