fix: custom_endpoint

This commit is contained in:
Sakurasan
2024-12-18 01:00:45 +08:00
parent 000fc2f616
commit f8b364a052
2 changed files with 10 additions and 21 deletions

View File

@@ -2,22 +2,18 @@ package router
import (
"crypto/tls"
"fmt"
"log"
"net"
"net/http"
"net/http/httputil"
"opencatd-open/pkg/claude"
oai "opencatd-open/pkg/openai"
"opencatd-open/store"
"os"
"time"
"github.com/gin-gonic/gin"
)
var (
baseUrl = "https://api.openai.com"
GPT3Dot5Turbo = "gpt-3.5-turbo"
GPT4 = "gpt-4"
)
@@ -62,13 +58,6 @@ var (
// } `json:"usage"`
// }
func init() {
if openai_endpoint := os.Getenv("openai_endpoint"); openai_endpoint != "" {
log.Println(fmt.Sprintf("replace %s to %s", baseUrl, openai_endpoint))
baseUrl = openai_endpoint
}
}
func HandleProxy(c *gin.Context) {
var (
localuser bool