From b695e67154fef5eef83a5a1e0951af4e34d6a57e Mon Sep 17 00:00:00 2001 From: CaIon Date: Sun, 6 Jul 2025 10:35:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20refactor(channel):=20replace=20c?= =?UTF-8?q?ommon.ChannelTypeVertexAi=20with=20constant.ChannelTypeVertexAi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/channel.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/controller/channel.go b/controller/channel.go index 59177b7a..d65a53df 100644 --- a/controller/channel.go +++ b/controller/channel.go @@ -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{