2026-04-29 15:54:14 +08:00
|
|
|
|
package dto
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// CreateModelReq 添加模型配置
|
|
|
|
|
|
type CreateModelReq struct {
|
|
|
|
|
|
g.Meta `path:"/createModel" method:"post" tags:"模型管理" summary:"创建模型配置" dc:"添加新的模型配置"`
|
|
|
|
|
|
ModelName string `p:"modelName" json:"modelName" v:"required#modelName不能为空" dc:"模型名称(唯一标识)"`
|
2026-05-12 13:45:08 +08:00
|
|
|
|
ModelsType int `p:"modelsType" json:"modelsType" v:"required#modelsType不能为空" dc:"模型类型:1-文本生成 2-图像生成 3-语音 4-视频 5-多模态"`
|
2026-04-29 15:54:14 +08:00
|
|
|
|
BaseURL string `p:"baseUrl" json:"baseUrl" v:"required#baseUrl不能为空" dc:"模型服务基础地址(如 http(s)://host:port)"`
|
|
|
|
|
|
HttpMethod string `p:"httpMethod" json:"httpMethod" dc:"请求方式:GET/POST(默认POST)"`
|
2026-05-12 13:45:08 +08:00
|
|
|
|
HeadMsg string `p:"headMsg" json:"headMsg" dc:"请求头绑定(支持多个,逗号分隔),示例:Authorization:Bearer xxx,Content-Type:application/json"`
|
|
|
|
|
|
IsPrivate int `p:"isPrivate" json:"isPrivate" v:"in:0,1#私有化参数只能为0或1" dc:"是否私有化:0-私有(默认) 1-公共"`
|
|
|
|
|
|
Enabled int `p:"enabled" json:"enabled" v:"in:0,1#启用参数只能为0或1" dc:"是否启用:0-禁用,1-启用(默认1)"`
|
|
|
|
|
|
IsChatModel int `p:"isChatModel" json:"isChatModel" v:"in:0,1#对话模型参数只能为0或1" dc:"是否为对话模型:0-否,1-是(默认0)"`
|
|
|
|
|
|
ApiKey string `p:"apiKey" json:"apiKey" v:"required-if:isPrivate,1#公共模型必须填写API密钥" dc:"调用凭证/密钥,用于模型认证"`
|
|
|
|
|
|
Form any `p:"form" json:"form" dc:"动态表单配置(JSON),用于前端渲染配置项"`
|
|
|
|
|
|
RequestMapping any `p:"requestMapping" json:"requestMapping" dc:"请求映射"`
|
|
|
|
|
|
ResponseMapping any `p:"responseMapping" json:"responseMapping" dc:"返回映射"`
|
|
|
|
|
|
ResponseBody any `p:"responseBody" json:"responseBody" dc:"返回主体"`
|
|
|
|
|
|
TokenMapping string `p:"tokenMapping" json:"tokenMapping" dc:"token映射"`
|
|
|
|
|
|
MaxConcurrency int `p:"maxConcurrency" json:"maxConcurrency" dc:"最大并发数(默认10)"`
|
|
|
|
|
|
QueueLimit int `p:"queueLimit" json:"queueLimit" dc:"排队队列上限(默认1000)"`
|
|
|
|
|
|
TimeoutSeconds int `p:"timeoutSeconds" json:"timeoutSeconds" dc:"请求超时时间(秒,默认600)"`
|
|
|
|
|
|
ExpectedSeconds int `p:"expectedSeconds" json:"expectedSeconds" dc:"模型预计执行时间(秒,默认600)"`
|
|
|
|
|
|
RetryTimes int `p:"retryTimes" json:"retryTimes" dc:"失败重试次数(默认3)"`
|
|
|
|
|
|
RetryQueueMaxSeconds int `p:"retryQueueMaxSeconds" json:"retryQueueMaxSeconds" dc:"失败重试最大排队时间(秒,默认600)"`
|
|
|
|
|
|
AutoCleanSeconds int `p:"autoCleanSeconds" json:"autoCleanSeconds" dc:"任务完成后自动清理时间(秒,默认86400)"`
|
2026-04-29 15:54:14 +08:00
|
|
|
|
Remark string `p:"remark" json:"remark" dc:"备注说明"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type CreateModelRes struct {
|
|
|
|
|
|
ID int64 `json:"id,string" dc:"配置ID"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type UpdateModelReq struct {
|
|
|
|
|
|
g.Meta `path:"/updateModel" method:"put" tags:"模型管理" summary:"更新模型配置" dc:"更新指定ID的模型配置"`
|
2026-05-12 13:45:08 +08:00
|
|
|
|
ID int64 `p:"id" json:"id" v:"required#id不能为空" dc:"配置ID"`
|
|
|
|
|
|
ModelsType string `p:"modelsType" json:"modelsType" dc:"模型类型ID列表(逗号分隔)(可选更新)"`
|
|
|
|
|
|
BaseURL string `p:"baseUrl" json:"baseUrl" dc:"模型服务基础地址"`
|
|
|
|
|
|
HttpMethod string `p:"httpMethod" json:"httpMethod" dc:"请求方式:GET/POST(可选更新)"`
|
|
|
|
|
|
HeadMsg string `p:"headMsg" json:"headMsg" dc:"请求头绑定(可选更新)"`
|
|
|
|
|
|
Form any `p:"form" json:"form" dc:"动态表单配置(JSON)(可选更新)"`
|
|
|
|
|
|
RequestMapping any `p:"requestMapping" json:"requestMapping" dc:"请求参数映射(可选更新)"`
|
|
|
|
|
|
ResponseMapping any `p:"responseMapping" json:"responseMapping" dc:"返回参数映射(可选更新)"`
|
|
|
|
|
|
ResponseBody any `p:"responseBody" json:"responseBody" dc:"返回主体(可选更新)"`
|
|
|
|
|
|
TokenMapping string `p:"tokenMapping" json:"tokenMapping" dc:"token映射(可选更新)"`
|
|
|
|
|
|
Enabled int `p:"enabled" json:"enabled" dc:"是否启用:0-禁用,1-启用(可选更新)"`
|
|
|
|
|
|
IsChatModel int `p:"isChatModel" json:"isChatModel" v:"in:0,1#对话模型参数只能为0或1" dc:"是否为对话模型:0-否,1-是(默认0)"`
|
|
|
|
|
|
MaxConcurrency int `p:"maxConcurrency" json:"maxConcurrency" dc:"最大并发数(可选更新)"`
|
|
|
|
|
|
QueueLimit int `p:"queueLimit" json:"queueLimit" dc:"排队队列上限(可选更新)"`
|
|
|
|
|
|
TimeoutSeconds int `p:"timeoutSeconds" json:"timeoutSeconds" dc:"请求超时时间(秒)(可选更新)"`
|
|
|
|
|
|
ExpectedSeconds int `p:"expectedSeconds" json:"expectedSeconds" dc:"模型预计执行时间(秒)(可选更新)"`
|
|
|
|
|
|
RetryTimes int `p:"retryTimes" json:"retryTimes" dc:"失败重试次数(可选更新)"`
|
|
|
|
|
|
RetryQueueMaxSeconds int `p:"retryQueueMaxSeconds" json:"retryQueueMaxSeconds" dc:"失败重试最大排队时间(秒)(可选更新)"`
|
|
|
|
|
|
AutoCleanSeconds int `p:"autoCleanSeconds" json:"autoCleanSeconds" dc:"自动清理间隔(秒)(可选更新)"`
|
|
|
|
|
|
Remark string `p:"remark" json:"remark" dc:"备注说明(可选更新)"`
|
2026-04-29 15:54:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// DeleteModelReq 删除模型配置
|
|
|
|
|
|
type DeleteModelReq struct {
|
|
|
|
|
|
g.Meta `path:"/deleteModel" method:"delete" tags:"模型管理" summary:"删除模型配置" dc:"删除指定ID的模型配置"`
|
2026-05-12 13:45:08 +08:00
|
|
|
|
ID string `p:"id" json:"id,string" v:"required#id不能为空" dc:"配置ID"`
|
2026-04-29 15:54:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetModelReq 获取模型配置详情
|
|
|
|
|
|
type GetModelReq struct {
|
2026-05-12 13:45:08 +08:00
|
|
|
|
g.Meta `path:"/getModel" method:"get" tags:"模型管理" summary:"获取模型配置" dc:"根据模型ID获取配置详情"`
|
2026-04-29 15:54:14 +08:00
|
|
|
|
ID int64 `p:"id" json:"id,string" v:"required#id不能为空" dc:"配置ID"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type GetModelRes struct {
|
|
|
|
|
|
Model any `json:"model" dc:"模型配置详情"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ListModelReq 配置列表
|
|
|
|
|
|
type ListModelReq struct {
|
2026-05-12 13:45:08 +08:00
|
|
|
|
g.Meta `path:"/listModel" method:"get" tags:"模型管理" summary:"模型配置列表" dc:"分页获取模型配置列表"`
|
|
|
|
|
|
PageNum int `p:"pageNum" json:"pageNum" dc:"页码(默认1)"`
|
|
|
|
|
|
PageSize int `p:"pageSize" json:"pageSize" dc:"每页条数(默认10)"`
|
|
|
|
|
|
ModelName string `p:"modelName" json:"modelName" dc:"模型名称(模糊查询,可选)"`
|
|
|
|
|
|
ModelType int `p:"modelType" json:"modelType" dc:"模型类型"`
|
2026-04-29 15:54:14 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type ListModelRes struct {
|
|
|
|
|
|
List any `json:"list" dc:"列表数据"`
|
|
|
|
|
|
Total int64 `json:"total" dc:"总数"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// AutoTuneReq 动态调参(由上层定时任务每小时触发一次)
|
|
|
|
|
|
type AutoTuneReq struct {
|
2026-05-12 13:45:08 +08:00
|
|
|
|
g.Meta `path:"/autoTune" method:"post" tags:"模型管理" summary:"动态调参" dc:"按 model_name 维度统计指定时间窗口内执行耗时(P90),动态生成运行时 max_concurrency/queue_limit(不超过配置上限),写入 Redis 供 Worker/CreateTask 使用;windowSeconds 不传默认 3600"`
|
2026-04-29 15:54:14 +08:00
|
|
|
|
WindowSeconds int `p:"windowSeconds" json:"windowSeconds" dc:"统计窗口秒数;不传/<=0 默认 3600(1小时)"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type AutoTuneRes struct {
|
|
|
|
|
|
List any `json:"list" dc:"调参结果列表"`
|
|
|
|
|
|
}
|
2026-05-12 13:45:08 +08:00
|
|
|
|
|
|
|
|
|
|
type ModelTypeModelItem struct {
|
|
|
|
|
|
ID int64 `json:"id" dc:"模型主键ID"`
|
|
|
|
|
|
Name string `json:"name" dc:"模型名称"`
|
|
|
|
|
|
Form any `json:"form" dc:"动态表单配置(JSON数组),用于前端渲染"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ListModelTypeReq 模型类型列表(分页)
|
|
|
|
|
|
type ListTypeReq struct {
|
|
|
|
|
|
g.Meta `path:"/listType" method:"get" tags:"模型类型列表" summary:"模型类型列表" dc:"分页获取模型类型列表"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type TypeItem struct {
|
|
|
|
|
|
Type map[int]string `json:"type" dc:"模型类型ID到名称的映射"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type UpdateChatModelReq struct {
|
|
|
|
|
|
g.Meta `path:"/updateChatModel" method:"post" tags:"模型管理" summary:"更新聊天模型" dc:"更新指定模型的聊天模型"`
|
|
|
|
|
|
Id int64 `p:"id" json:"id" v:"required#model不能为空" dc:"模型id"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type GetIsChatModelReq struct {
|
|
|
|
|
|
g.Meta `path:"/getIsChatModel" method:"get" tags:"模型管理" summary:"获取模型是否为聊天模型" dc:"根据模型ID获取是否为聊天模型"`
|
|
|
|
|
|
}
|