a18e4847c2
- 新增 BaseRepository 泛型接口,定义通用增删改查方法 - 实现 BaseRepo 结构体及其 Insert 方法 - 定义 ProviderRepository、ModelRepository、ChannelRepository、APIKeyRepository 接口,继承基础接口 - 将模型结构 JanusModel 和 JanusProvider 重命名为 Model 和 Provider - 创建 ProviderRepo 结构体,组合基础仓库实现 Provider 仓库功能
30 lines
633 B
Go
30 lines
633 B
Go
package model
|
|
|
|
import (
|
|
"synoth.com/janus/internal/core"
|
|
"synoth.com/janus/internal/enum"
|
|
)
|
|
|
|
// Type 模型类型
|
|
type Type string
|
|
|
|
// Model 供应商下可用的AI模型
|
|
type Model struct {
|
|
core.BaseModel
|
|
// ProviderID 供应商ID
|
|
ProviderID int64 `gorm:"not null" json:"provider_id"`
|
|
// Name 模型名称
|
|
Name string `gorm:"not null" json:"name"`
|
|
// 模型类型
|
|
ModelType Type `gorm:"not null" json:"model_type"`
|
|
// 模型状态
|
|
Status enum.Status `gorm:"default:1;not null" json:"status"`
|
|
}
|
|
|
|
const (
|
|
Chat Type = "chat"
|
|
Completion Type = "completion"
|
|
Embedding Type = "embedding"
|
|
Image Type = "image"
|
|
)
|