Files
geekai/api/store/model/api_key.go
2025-04-29 22:55:30 +08:00

25 lines
1.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"time"
)
// ApiKey OpenAI API 模型
type ApiKey struct {
Id uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
Name string `gorm:"column:name;type:varchar(30);comment:名称" json:"name"`
Value string `gorm:"column:value;type:varchar(255);not null;comment:API KEY value" json:"value"`
Type string `gorm:"column:type;type:varchar(10);default:chat;not null;comment:用途chat=>聊天img=>图片)" json:"type"`
LastUsedAt int64 `gorm:"column:last_used_at;type:int;not null;comment:最后使用时间" json:"last_used_at"`
ApiURL string `gorm:"column:api_url;type:varchar(255);comment:API 地址" json:"api_url"`
Enabled bool `gorm:"column:enabled;type:tinyint(1);comment:是否启用" json:"enabled"`
ProxyURL string `gorm:"column:proxy_url;type:varchar(100);comment:代理地址" json:"proxy_url"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
}
// TableName 表名
func (m *ApiKey) TableName() string {
return "chatgpt_api_keys"
}