update openai struct

This commit is contained in:
Sakurasan
2024-12-20 02:42:49 +08:00
parent 07bcabc5d4
commit fb5b1a55ae
3 changed files with 30 additions and 20 deletions

View File

@@ -4,6 +4,7 @@ import (
"errors"
"log"
"math/rand"
"os"
"strings"
"time"
@@ -76,6 +77,9 @@ func SelectKeyCache(apitype string) (Key, error) {
func SelectKeyCacheByModel(model string) (Key, error) {
var keys []Key
if os.Getenv("OPENAI_API_KEY") != "" {
keys = append(keys, Key{ApiType: "openai", Key: os.Getenv("OPENAI_API_KEY")})
}
items := KeysCache.Items()
for _, item := range items {
if strings.Contains(model, "realtime") {