Compare commits

..

2 Commits

4 changed files with 60 additions and 0 deletions

View File

@@ -61,3 +61,43 @@ var ModelTypeName = map[int]string{
VideoSubTypeVideoToVideo: "视频模型-视频生视频",
VideoSubTypeVideoEdit: "视频模型-视频编辑",
}
// 运营商常量
const (
OperatorAliyun = "阿里云百炼"
OperatorVolcengine = "火山引擎"
OperatorTencent = "腾讯云"
OperatorHuawei = "华为云"
OperatorBaidu = "百度智能云"
OperatorOpenAI = "OpenAI"
OperatorAzure = "Azure OpenAI"
OperatorAWS = "AWS Bedrock"
OperatorGoogle = "Google Cloud"
OperatorDeepSeek = "DeepSeek"
OperatorMoonshot = "Moonshot"
OperatorZhipu = "智谱AI"
OperatorBaichuan = "百川智能"
OperatorMinimax = "MiniMax"
OperatorXunfei = "科大讯飞"
OperatorOthers = "其他"
)
// OperatorList 运营商列表(供前端下拉框使用)
var OperatorList = []string{
OperatorAliyun,
OperatorVolcengine,
OperatorTencent,
OperatorHuawei,
OperatorBaidu,
OperatorOpenAI,
OperatorAzure,
OperatorAWS,
OperatorGoogle,
OperatorDeepSeek,
OperatorMoonshot,
OperatorZhipu,
OperatorBaichuan,
OperatorMinimax,
OperatorXunfei,
OperatorOthers,
}

View File

@@ -49,6 +49,11 @@ func (c *model) ListType(ctx context.Context, req *dto.ListTypeReq) (res *dto.Ty
return service.GetModelTypesFromConfig()
}
// ListOperator 运营商列表
func (c *model) ListOperator(ctx context.Context, req *dto.ListOperatorReq) (res *dto.ListOperatorRes, err error) {
return service.GetOperatorList()
}
// UpdateChatModel 更新是否为聊天模型
func (c *model) UpdateChatModel(ctx context.Context, req *dto.UpdateChatModelReq) (res *dto.UpdateChatModelRes, err error) {
err = service.Model.UpdateChatModel(ctx, req)

View File

@@ -136,6 +136,14 @@ type TypeItem struct {
Type map[int]string `json:"type" dc:"模型类型ID到名称的映射"`
}
type ListOperatorReq struct {
g.Meta `path:"/listOperator" method:"get" tags:"模型管理" summary:"获取运营商列表" dc:"获取运营商列表"`
}
type ListOperatorRes struct {
List []string `json:"list" 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"`

View File

@@ -303,6 +303,13 @@ func GetModelTypesFromConfig() (res *dto.TypeItem, err error) {
}, nil
}
// GetOperatorList 获取运营商列表
func GetOperatorList() (res *dto.ListOperatorRes, err error) {
return &dto.ListOperatorRes{
List: public.OperatorList,
}, nil
}
func (s *modelService) UpdateChatModel(ctx context.Context, req *dto.UpdateChatModelReq) error {
// 校验新会话模型是否存在
newModel, err := dao.Model.GetByAcrossTenant(ctx, &entity.AsynchModel{