fix select key

This commit is contained in:
Sakurasan
2025-04-20 18:33:59 +08:00
parent b83c6d9786
commit b80f0759a5
5 changed files with 29 additions and 26 deletions

View File

@@ -8,12 +8,13 @@ import (
"opencatd-open/internal/model"
"os"
"strings"
"time"
"github.com/tidwall/gjson"
"gorm.io/gorm"
)
var client = &http.Client{}
var client = &http.Client{Timeout: 2 * time.Second}
func init() {
if os.Getenv("LOCAL_PROXY") != "" {
@@ -29,13 +30,13 @@ func FetchKeyModel(db *gorm.DB, key *model.ApiKey) ([]string, error) {
var err error
if *key.ApiType == "openai" || *key.ApiType == "azure" {
supportModels, err = FetchOpenAISupportModels(db, key)
if err != nil {
fmt.Println(err)
}
}
if *key.ApiType == "claude" {
supportModels, err = FetchClaudeSupportModels(db, key)
}
if err != nil {
fmt.Println(err)
}
return supportModels, err
}