sanbo
commited on
Commit
·
2224f03
1
Parent(s):
6390363
update sth. at 2024-11-14 14:50:25
Browse files- initialize/router.go +15 -0
initialize/router.go
CHANGED
@@ -31,17 +31,32 @@ func RegisterRouter() *gin.Engine {
|
|
31 |
if prefixGroup != "" {
|
32 |
prefixRouter := router.Group(prefixGroup)
|
33 |
{
|
|
|
34 |
prefixRouter.OPTIONS("/v1/chat/completions", optionsHandler)
|
35 |
prefixRouter.OPTIONS("/v1/chat/models", optionsHandler)
|
36 |
prefixRouter.POST("/v1/chat/completions", middlewares.Authorization, handler.duckduckgo)
|
37 |
prefixRouter.GET("/v1/models", middlewares.Authorization, handler.engines)
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
}
|
40 |
|
41 |
router.OPTIONS("/v1/chat/completions", optionsHandler)
|
42 |
router.OPTIONS("/v1/chat/models", optionsHandler)
|
43 |
authGroup := router.Group("").Use(middlewares.Authorization)
|
|
|
|
|
44 |
authGroup.POST("/v1/chat/completions", handler.duckduckgo)
|
|
|
|
|
|
|
45 |
authGroup.GET("/v1/models", handler.engines)
|
|
|
|
|
|
|
46 |
return router
|
47 |
}
|
|
|
31 |
if prefixGroup != "" {
|
32 |
prefixRouter := router.Group(prefixGroup)
|
33 |
{
|
34 |
+
// 现有的路由
|
35 |
prefixRouter.OPTIONS("/v1/chat/completions", optionsHandler)
|
36 |
prefixRouter.OPTIONS("/v1/chat/models", optionsHandler)
|
37 |
prefixRouter.POST("/v1/chat/completions", middlewares.Authorization, handler.duckduckgo)
|
38 |
prefixRouter.GET("/v1/models", middlewares.Authorization, handler.engines)
|
39 |
+
|
40 |
+
// 新增的路由
|
41 |
+
prefixRouter.POST("/api/v1/chat/completions", middlewares.Authorization, handler.duckduckgo)
|
42 |
+
prefixRouter.POST("/completions", middlewares.Authorization, handler.duckduckgo)
|
43 |
+
prefixRouter.GET("/api/v1/models", middlewares.Authorization, handler.engines)
|
44 |
+
prefixRouter.GET("/models", middlewares.Authorization, handler.engines)
|
45 |
}
|
46 |
}
|
47 |
|
48 |
router.OPTIONS("/v1/chat/completions", optionsHandler)
|
49 |
router.OPTIONS("/v1/chat/models", optionsHandler)
|
50 |
authGroup := router.Group("").Use(middlewares.Authorization)
|
51 |
+
|
52 |
+
// authGroup 下的路由
|
53 |
authGroup.POST("/v1/chat/completions", handler.duckduckgo)
|
54 |
+
authGroup.POST("/api/v1/chat/completions", handler.duckduckgo)
|
55 |
+
authGroup.POST("/completions", handler.duckduckgo)
|
56 |
+
|
57 |
authGroup.GET("/v1/models", handler.engines)
|
58 |
+
authGroup.GET("/api/v1/models", handler.engines)
|
59 |
+
authGroup.GET("/models", handler.engines)
|
60 |
+
|
61 |
return router
|
62 |
}
|