Update main.go

This commit is contained in:
yx135 2024-06-08 10:37:06 +08:00 committed by GitHub
parent c251f84df5
commit c1f644514c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -176,16 +176,17 @@ func (s *ProxyService) InitRoutes(e *gin.Engine) {
authToken := s.cfg.AuthToken // replace with your dynamic value as needed
if authToken != "" {
// 鉴权
v1 := e.Group("/:token/", AuthMiddleware(authToken))
v1 := e.Group("/:token/v1/", AuthMiddleware(authToken))
{
v1.POST("/chat/completions", s.completions)
v1.POST("/v1/engines/copilot-codex/completions", s.codeCompletions)
v1.POST("/engines/copilot-codex/completions", s.codeCompletions)
}
} else {
e.POST("/chat/completions", s.completions)
e.POST("/v1/engines/copilot-codex/completions", s.codeCompletions)
}
}
type Pong struct {
Now int `json:"now"`
Status string `json:"status"`