Files
rag/model/dto/model.go

115 lines
4.1 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 dto
import (
"rag/consts/model"
"time"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
type GetModelAllEnumsReq struct {
g.Meta `path:"/getAllEnums" method:"get" tags:"模型配置管理" summary:"获取全量模型枚举(类型+配置)"`
}
type GetModelEnumRes struct {
Options []ModelEnumOption `json:"options"`
}
// ModelEnumOption 主类型模型类型vector/chat
type ModelEnumOption struct {
Key interface{} `json:"key"`
Value interface{} `json:"value"`
ConfigTypes []ModelKeyValue `json:"configTypes"` // 这里统一!
}
// ModelKeyValue 统一的 KV 结构 → 给模型类型 + 配置类型共用
type ModelKeyValue struct {
Key interface{} `json:"key"`
Value interface{} `json:"value"`
}
// GetModelConfigFormFieldsReq 获取模型配置表单请求
type GetModelConfigFormFieldsReq struct {
g.Meta `path:"/getModelFormField" method:"get" tags:"模型配置管理" summary:"获取模型表单" dc:"获取模型表单列表"`
ModelType model.ModelType `json:"modelType"` // 模型类型 vector/chat
ConfigType model.ModelConfigType `json:"configType"` // 配置类型 ark/ollama/openai...
}
// GetModelConfigFormFieldsRes 获取模型配置表单响应
type GetModelConfigFormFieldsRes struct {
ModelType model.ModelType `json:"modelType"`
ConfigType model.ModelConfigType `json:"configType"`
Fields []map[string]interface{} `json:"fields"`
}
// CreateModelReq 创建模型请求
type CreateModelReq struct {
g.Meta `path:"/create" method:"post" tags:"模型配置管理" summary:"创建模型配置" dc:"创建模型配置"`
ModelType model.ModelType `json:"modelType" v:"required#模型类型不能为空"`
ModelName string `json:"modelName" v:"required#模型名称不能为空"`
ModelDesc string `json:"modelDesc"`
ConfigType model.ModelConfigType `json:"configType"`
ConfigContent map[string]interface{} `json:"configContent"`
}
// CreateModelRes 创建模型响应
type CreateModelRes struct {
Id int64 `json:"id,string"`
}
// UpdateModelReq 更新模型请求
type UpdateModelReq struct {
g.Meta `path:"/update" method:"put" tags:"模型配置管理" summary:"更新模型配置" dc:"更新模型配置"`
Id int64 `json:"id" v:"required#ID不能为空"`
ModelType model.ModelType `json:"modelType"`
ModelName string `json:"modelName"`
ModelDesc string `json:"modelDesc"`
ConfigType model.ModelConfigType `json:"configType"`
ConfigContent map[string]interface{} `json:"configContent"`
}
// DeleteModelReq 删除模型请求
type DeleteModelReq struct {
g.Meta `path:"/delete" method:"delete" tags:"模型配置管理" summary:"删除模型配置" dc:"删除模型配置"`
Id int64 `json:"id" v:"required#ID不能为空"`
}
// GetModelReq 获取模型请求
type GetModelReq struct {
g.Meta `path:"/get" method:"get" tags:"模型配置管理" summary:"获取模型配置详情" dc:"获取模型配置详情"`
Id int64 `json:"id"`
ModelType model.ModelType `json:"modelType"`
}
// ListModelReq 获取模型列表请求
type ListModelReq struct {
g.Meta `path:"/list" method:"get" tags:"模型配置管理" summary:"获取模型配置列表" dc:"分页查询模型配置列表,支持多条件筛选"`
Page *beans.Page `json:"page"`
ModelType model.ModelType `json:"modelType"`
ModelName string `json:"modelName"`
}
// ListModelRes 获取模型列表响应
type ListModelRes struct {
List []*ModelVO `json:"list"`
Total int `json:"total"`
}
type ModelVO struct {
Id int64 `json:"id,string"`
ModelType model.ModelType `json:"modelType"`
ModelName string `json:"modelName"`
ModelDesc string `json:"modelDesc"`
ConfigType model.ModelConfigType `json:"configType"`
ConfigContent map[string]interface{} `json:"configContent"`
CreateTime time.Time `json:"createTime"`
UpdateTime time.Time `json:"updateTime"`
}