reset openai endpoint

This commit is contained in:
Sakurasan
2023-05-28 22:28:52 +08:00
parent d012391f15
commit ae1670b9b8

View File

@@ -13,6 +13,7 @@ import (
"net/http" "net/http"
"net/http/httputil" "net/http/httputil"
"opencatd-open/store" "opencatd-open/store"
"os"
"strings" "strings"
"time" "time"
@@ -90,6 +91,13 @@ type ChatCompletionResponse struct {
} `json:"usage"` } `json:"usage"`
} }
func init() {
if openai_endpoint := os.Getenv("openai_endpoint"); openai_endpoint != "" {
log.Println("replace %s to %s", baseUrl, openai_endpoint)
baseUrl = openai_endpoint
}
}
func AuthMiddleware() gin.HandlerFunc { func AuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) { return func(c *gin.Context) {
if rootToken == "" { if rootToken == "" {