23 lines
1002 B
Go
23 lines
1002 B
Go
package app
|
|
|
|
import (
|
|
"git.echol.cn/loser/ai_proxy/server/global"
|
|
)
|
|
|
|
// AiApiKey AI API密钥管理
|
|
type AiApiKey struct {
|
|
global.GVA_MODEL
|
|
Name string `json:"name" gorm:"type:varchar(100);not null;comment:密钥名称"`
|
|
Key string `json:"key" gorm:"type:varchar(255);not null;uniqueIndex;comment:API密钥"`
|
|
AllowedModels []string `json:"allowed_models" gorm:"type:json;serializer:json;comment:允许使用的模型列表"`
|
|
AllowedPresets []string `json:"allowed_presets" gorm:"type:json;serializer:json;comment:允许使用的预设列表"`
|
|
RateLimit int `json:"rate_limit" gorm:"default:0;comment:速率限制(每分钟请求数,0表示不限制)"`
|
|
ExpiresAt *int64 `json:"expires_at" gorm:"comment:过期时间(Unix时间戳)"`
|
|
Enabled bool `json:"enabled" gorm:"default:true;comment:是否启用"`
|
|
UserID uint `json:"user_id" gorm:"index;comment:用户ID"`
|
|
}
|
|
|
|
func (AiApiKey) TableName() string {
|
|
return "ai_api_keys"
|
|
}
|