diff --git a/router/router.go b/router/router.go index c0a1972..7f0e132 100644 --- a/router/router.go +++ b/router/router.go @@ -13,6 +13,7 @@ import ( "net/http" "net/http/httputil" "opencatd-open/store" + "os" "strings" "time" @@ -90,6 +91,13 @@ type ChatCompletionResponse struct { } `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 { return func(c *gin.Context) { if rootToken == "" {