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

@@ -28,7 +28,7 @@ func (a Api) CreateApiKey(c *gin.Context) {
}
if slice.Contain([]string{"openai", "azure", "claude"}, *newkey.ApiType) {
sma, err := utils.FetchKeyModel(a.db, newkey)
if err == nil {
if err == nil && len(sma) > 0 {
newkey.SupportModelsArray = sma
var buf = new(bytes.Buffer)
json.NewEncoder(buf).Encode(sma) //nolint:errcheck