azure openai

This commit is contained in:
Sakurasan
2023-05-27 22:47:32 +08:00
parent 2f7567d23e
commit 9c04122680
5 changed files with 105 additions and 27 deletions

View File

@@ -26,18 +26,18 @@ func LoadKeysCache() {
return
}
for idx, key := range keys {
KeysCache.Set(to.String(idx), key.Key, cache.NoExpiration)
KeysCache.Set(to.String(idx), key, cache.NoExpiration)
}
}
func FromKeyCacheRandomItem() string {
func FromKeyCacheRandomItemKey() Key {
items := KeysCache.Items()
if len(items) == 1 {
return items[to.String(0)].Object.(string)
return items[to.String(0)].Object.(Key)
}
idx := rand.Intn(len(items))
item := items[to.String(idx)]
return item.Object.(string)
return item.Object.(Key)
}
func LoadAuthCache() {