Files
st/server/model/app/ai_provider.go

37 lines
1.5 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 app
import (
"git.echol.cn/loser/st/server/global"
"gorm.io/datatypes"
)
// AIProvider AI 服务提供商配置
type AIProvider struct {
global.GVA_MODEL
UserID *uint `json:"userId" gorm:"index;comment:用户IDNULL表示系统配置"`
User *AppUser `json:"user" gorm:"foreignKey:UserID"`
ProviderName string `json:"providerName" gorm:"type:varchar(100);not null;index;comment:提供商名称"`
APIConfig datatypes.JSON `json:"apiConfig" gorm:"type:jsonb;not null;comment:API配置加密存储"`
IsEnabled bool `json:"isEnabled" gorm:"default:true;comment:是否启用"`
IsDefault bool `json:"isDefault" gorm:"default:false;comment:是否为默认提供商"`
}
func (AIProvider) TableName() string {
return "ai_providers"
}
// AIModel AI 模型配置
type AIModel struct {
global.GVA_MODEL
ProviderID uint `json:"providerId" gorm:"not null;index;comment:提供商ID"`
Provider *AIProvider `json:"provider" gorm:"foreignKey:ProviderID"`
ModelName string `json:"modelName" gorm:"type:varchar(200);not null;comment:模型名称"`
DisplayName string `json:"displayName" gorm:"type:varchar(200);comment:模型显示名称"`
Config datatypes.JSON `json:"config" gorm:"type:jsonb;comment:模型参数配置"`
IsEnabled bool `json:"isEnabled" gorm:"default:true;comment:是否启用"`
}
func (AIModel) TableName() string {
return "ai_models"
}