fix:ali embedding model: v2 and v3

This commit is contained in:
xuejia 2024-08-13 23:43:23 +08:00
parent 6209ff9ea9
commit 986a7cef65

View File

@ -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