From 986a7cef65871071f7839ec4d30e082ed5a51149 Mon Sep 17 00:00:00 2001 From: xuejia Date: Tue, 13 Aug 2024 23:43:23 +0800 Subject: [PATCH] fix:ali embedding model: v2 and v3 --- relay/adaptor/ali/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/relay/adaptor/ali/main.go b/relay/adaptor/ali/main.go index f9039dbe..759e08b1 100644 --- a/relay/adaptor/ali/main.go +++ b/relay/adaptor/ali/main.go @@ -59,7 +59,7 @@ func ConvertRequest(request model.GeneralOpenAIRequest) *ChatRequest { func ConvertEmbeddingRequest(request model.GeneralOpenAIRequest) *EmbeddingRequest { return &EmbeddingRequest{ - Model: "text-embedding-v1", + Model: request.Model, Input: struct { Texts []string `json:"texts"` }{ @@ -102,8 +102,9 @@ func EmbeddingHandler(c *gin.Context, resp *http.Response) (*model.ErrorWithStat StatusCode: resp.StatusCode, }, nil } - + reqeustModel := c.Keys["request_model"] fullTextResponse := embeddingResponseAli2OpenAI(&aliResponse) + fullTextResponse.Model = reqeustModel.(string) jsonResponse, err := json.Marshal(fullTextResponse) if err != nil { return openai.ErrorWrapper(err, "marshal_response_body_failed", http.StatusInternalServerError), nil