From f7a1f72d686b61d9fc1a84cf7a30a542b3777a7f Mon Sep 17 00:00:00 2001 From: "Laisky.Cai" Date: Mon, 15 Jul 2024 06:28:03 +0000 Subject: [PATCH] fix: update GetAdaptor function to use the actual model name The GetAdaptor function in the Adaptor struct has been updated to use the actual model name instead of the origin model name. This change ensures that the correct adaptor is retrieved for processing the response. --- relay/adaptor/vertexai/adaptor.go | 2 +- relay/meta/relay_meta.go | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/relay/adaptor/vertexai/adaptor.go b/relay/adaptor/vertexai/adaptor.go index 6bca7bec..cf5d4c48 100644 --- a/relay/adaptor/vertexai/adaptor.go +++ b/relay/adaptor/vertexai/adaptor.go @@ -38,7 +38,7 @@ func (a *Adaptor) ConvertRequest(c *gin.Context, relayMode int, request *model.G } func (a *Adaptor) DoResponse(c *gin.Context, resp *http.Response, meta *meta.Meta) (usage *model.Usage, err *model.ErrorWithStatusCode) { - adaptor := GetAdaptor(meta.OriginModelName) + adaptor := GetAdaptor(meta.ActualModelName) if adaptor == nil { return nil, &relaymodel.ErrorWithStatusCode{ StatusCode: http.StatusInternalServerError, diff --git a/relay/meta/relay_meta.go b/relay/meta/relay_meta.go index b2f1e6ce..6167bffe 100644 --- a/relay/meta/relay_meta.go +++ b/relay/meta/relay_meta.go @@ -11,20 +11,22 @@ import ( ) type Meta struct { - Mode int - ChannelType int - ChannelId int - TokenId int - TokenName string - UserId int - Group string - ModelMapping map[string]string - BaseURL string - APIKey string - APIType int - Config model.ChannelConfig - IsStream bool + Mode int + ChannelType int + ChannelId int + TokenId int + TokenName string + UserId int + Group string + ModelMapping map[string]string + BaseURL string + APIKey string + APIType int + Config model.ChannelConfig + IsStream bool + // OriginModelName is the model name from the raw user request OriginModelName string + // ActualModelName is the model name after mapping ActualModelName string RequestURLPath string PromptTokens int // only for DoResponse