Spaces:
Sleeping
Sleeping
File size: 721 Bytes
931bd01 a3a6081 931bd01 a3a6081 931bd01 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
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
}
|