🔧 refactor(channel): replace common.ChannelTypeVertexAi with constant.ChannelTypeVertexAi

This commit is contained in:
CaIon
2025-07-06 10:35:29 +08:00
parent fa2cd85007
commit b695e67154

View File

@@ -437,7 +437,7 @@ func AddChannel(c *gin.Context) {
switch addChannelRequest.Mode {
case "multi_to_single":
addChannelRequest.Channel.ChannelInfo.MultiKeyMode = true
if addChannelRequest.Channel.Type == common.ChannelTypeVertexAi {
if addChannelRequest.Channel.Type == constant.ChannelTypeVertexAi {
if !common.IsJsonStr(addChannelRequest.Channel.Key) {
c.JSON(http.StatusOK, gin.H{
"success": false,
@@ -464,15 +464,8 @@ func AddChannel(c *gin.Context) {
}
keys = []string{addChannelRequest.Channel.Key}
case "batch":
if addChannelRequest.Channel.Type == common.ChannelTypeVertexAi {
if addChannelRequest.Channel.Type == constant.ChannelTypeVertexAi {
// multi json
if !common.IsJsonStr(addChannelRequest.Channel.Key) {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "Vertex AI 批量添加模式必须使用标准的JsonArray格式例如[{key1}, {key2}...],请检查输入",
})
return
}
toMap := common.StrToMap(addChannelRequest.Channel.Key)
if toMap == nil {
c.JSON(http.StatusOK, gin.H{