fix active key,suffix

This commit is contained in:
Sakurasan
2025-04-20 16:22:23 +08:00
parent fe0f2a7e88
commit b83c6d9786
11 changed files with 106 additions and 119 deletions

View File

@@ -47,6 +47,9 @@ func FetchOpenAISupportModels(db *gorm.DB, apikey *model.ApiKey) ([]string, erro
var supportModels []string
var req *http.Request
if *apikey.ApiType == "azure" {
if strings.HasSuffix(*apikey.Endpoint, "/") {
apikey.Endpoint = ToPtr(strings.TrimSuffix(*apikey.Endpoint, "/"))
}
req, _ = http.NewRequest("GET", *apikey.Endpoint+azureModelsUrl, nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", *apikey.ApiKey)