Просмотр исходного кода

fix: add missing UpstreamModelName

[email protected] 1 год назад
Родитель
Сommit
cbe0a1fa76
3 измененных файлов с 1 добавлено и 4 удалено
  1. 0 2
      middleware/distributor.go
  2. 0 2
      relay/common/relay_info.go
  3. 1 0
      relay/relay-text.go

+ 0 - 2
middleware/distributor.go

@@ -116,8 +116,6 @@ func Distribute() func(c *gin.Context) {
 				abortWithMessage(c, http.StatusServiceUnavailable, fmt.Sprintf("当前分组 %s 下对于模型 %s 无可用渠道(数据库一致性已被破坏)", userGroup, modelRequest.Model))
 				return
 			}
-
-			c.Set("model_name", modelRequest.Model)
 		}
 		c.Set("channel", channel.Type)
 		c.Set("channel_id", channel.Id)

+ 0 - 2
relay/common/relay_info.go

@@ -34,7 +34,6 @@ func GenRelayInfo(c *gin.Context) *RelayInfo {
 	userId := c.GetInt("id")
 	group := c.GetString("group")
 	tokenUnlimited := c.GetBool("token_unlimited_quota")
-	upstreamModelName := c.GetString("model_name")
 	startTime := time.Now()
 
 	apiType := constant.ChannelType2APIType(channelType)
@@ -53,7 +52,6 @@ func GenRelayInfo(c *gin.Context) *RelayInfo {
 		ApiType:        apiType,
 		ApiVersion:     c.GetString("api_version"),
 		ApiKey:         strings.TrimPrefix(c.Request.Header.Get("Authorization"), "Bearer "),
-		UpstreamModelName: upstreamModelName,
 	}
 	if info.BaseUrl == "" {
 		info.BaseUrl = common.ChannelBaseURLs[channelType]

+ 1 - 0
relay/relay-text.go

@@ -59,6 +59,7 @@ func getAndValidateTextRequest(c *gin.Context, relayInfo *relaycommon.RelayInfo)
 		}
 	}
 	relayInfo.IsStream = textRequest.Stream
+	relayInfo.UpstreamModelName = textRequest.Model
 	return textRequest, nil
 }