From c6fd01a61d004675a4a8ad76cfa42963a6c35421 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Sun, 5 Jan 2025 20:42:00 +0800 Subject: [PATCH] fix: cros --- service/aiproxy/main.go | 4 ++-- service/aiproxy/router/relay.go | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/service/aiproxy/main.go b/service/aiproxy/main.go index 2742f42ce00..42c997935be 100644 --- a/service/aiproxy/main.go +++ b/service/aiproxy/main.go @@ -117,9 +117,9 @@ func setupHTTPServer() (*http.Server, *gin.Engine) { w := log.StandardLogger().Writer() server. - Use(middleware.NewLog(log.StandardLogger())). Use(gin.RecoveryWithWriter(w)). - Use(middleware.RequestID) + Use(middleware.NewLog(log.StandardLogger())). + Use(middleware.RequestID, middleware.CORS()) router.SetRouter(server) port := os.Getenv("PORT") diff --git a/service/aiproxy/router/relay.go b/service/aiproxy/router/relay.go index 2c6bdaef639..f33925bc528 100644 --- a/service/aiproxy/router/relay.go +++ b/service/aiproxy/router/relay.go @@ -11,10 +11,7 @@ import ( func SetRelayRouter(router *gin.Engine) { // https://platform.openai.com/docs/api-reference/introduction v1Router := router.Group("/v1") - v1Router.Use( - middleware.CORS(), - middleware.TokenAuth, - ) + v1Router.Use(middleware.TokenAuth) modelsRouter := v1Router.Group("/models") {