chore: change variable name

This commit is contained in:
JustSong 2024-04-19 23:50:28 +08:00
parent 9944dd5c39
commit 00fa86c000
4 changed files with 4 additions and 4 deletions

View File

@ -4,5 +4,5 @@ var (
Channel = "channel"
RequestModel = "request_model"
ConvertedRequest = "converted_request"
OriginModel = "origin_model"
OriginalModel = "original_model"
)

View File

@ -55,7 +55,7 @@ func Relay(c *gin.Context) {
lastFailedChannelId := channelId
channelName := c.GetString("channel_name")
group := c.GetString("group")
originalModel := c.GetString(ctxkey.OriginModel)
originalModel := c.GetString(ctxkey.OriginalModel)
go processChannelRelayError(ctx, channelId, channelName, bizErr)
requestId := c.GetString(logger.RequestIdKey)
retryTimes := config.RetryTimes

View File

@ -64,7 +64,7 @@ func SetupContextForSelectedChannel(c *gin.Context, channel *model.Channel, mode
c.Set("channel_id", channel.Id)
c.Set("channel_name", channel.Name)
c.Set("model_mapping", channel.GetModelMapping())
c.Set(ctxkey.OriginModel, modelName) // for retry
c.Set(ctxkey.OriginalModel, modelName) // for retry
c.Request.Header.Set("Authorization", fmt.Sprintf("Bearer %s", channel.Key))
c.Set("base_url", channel.GetBaseURL())
// this is for backward compatibility

View File

@ -212,7 +212,7 @@ func StreamHandler(c *gin.Context, resp *http.Response) (*relaymodel.ErrorWithSt
return true
}
response.Id = id
response.Model = c.GetString(ctxkey.OriginModel)
response.Model = c.GetString(ctxkey.OriginalModel)
response.Created = createdTime
jsonStr, err := json.Marshal(response)
if err != nil {