From 00fa86c00048b076812273988a9e8f8d9ed595dd Mon Sep 17 00:00:00 2001 From: JustSong Date: Fri, 19 Apr 2024 23:50:28 +0800 Subject: [PATCH] chore: change variable name --- common/ctxkey/key.go | 2 +- controller/relay.go | 2 +- middleware/distributor.go | 2 +- relay/adaptor/aws/main.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/ctxkey/key.go b/common/ctxkey/key.go index f7b702f6..2fa46841 100644 --- a/common/ctxkey/key.go +++ b/common/ctxkey/key.go @@ -4,5 +4,5 @@ var ( Channel = "channel" RequestModel = "request_model" ConvertedRequest = "converted_request" - OriginModel = "origin_model" + OriginalModel = "original_model" ) diff --git a/controller/relay.go b/controller/relay.go index a5f77eed..49408d13 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -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 diff --git a/middleware/distributor.go b/middleware/distributor.go index f3a05f5d..2c088dd2 100644 --- a/middleware/distributor.go +++ b/middleware/distributor.go @@ -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 diff --git a/relay/adaptor/aws/main.go b/relay/adaptor/aws/main.go index 8d8345ef..26098c49 100644 --- a/relay/adaptor/aws/main.go +++ b/relay/adaptor/aws/main.go @@ -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 {