31
server/model/app/ai_config.go
Normal file
31
server/model/app/ai_config.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// AIConfig AI配置模型
|
||||
type AIConfig struct {
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
|
||||
Name string `gorm:"type:varchar(100);not null" json:"name"` // 配置名称
|
||||
Provider string `gorm:"type:varchar(50);not null" json:"provider"` // 提供商 (openai/anthropic/custom)
|
||||
BaseURL string `gorm:"type:varchar(500)" json:"baseUrl"` // API Base URL
|
||||
APIKey string `gorm:"type:varchar(500)" json:"apiKey"` // API Key (加密存储)
|
||||
Models datatypes.JSON `gorm:"type:jsonb" json:"models"` // 可用模型列表
|
||||
DefaultModel string `gorm:"type:varchar(100)" json:"defaultModel"` // 默认模型
|
||||
Settings datatypes.JSON `gorm:"type:jsonb" json:"settings"` // 其他设置 (temperature等)
|
||||
IsActive bool `gorm:"default:false" json:"isActive"` // 是否激活
|
||||
IsDefault bool `gorm:"default:false" json:"isDefault"` // 是否为默认配置
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
func (AIConfig) TableName() string {
|
||||
return "ai_configs"
|
||||
}
|
||||
Reference in New Issue
Block a user