|
@@ -10,10 +10,8 @@ import (
|
|
|
"github.com/labring/aiproxy/core/relay/meta"
|
|
"github.com/labring/aiproxy/core/relay/meta"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
-const MetaEmbeddingsPatchInputToSlices = "embeddings_input_to_slices"
|
|
|
|
|
-
|
|
|
|
|
//nolint:gocritic
|
|
//nolint:gocritic
|
|
|
-func ConvertEmbeddingsRequest(meta *meta.Meta, req *http.Request) (string, http.Header, io.Reader, error) {
|
|
|
|
|
|
|
+func ConvertEmbeddingsRequest(meta *meta.Meta, req *http.Request, inputToSlices bool) (string, http.Header, io.Reader, error) {
|
|
|
reqMap := make(map[string]any)
|
|
reqMap := make(map[string]any)
|
|
|
err := common.UnmarshalBodyReusable(req, &reqMap)
|
|
err := common.UnmarshalBodyReusable(req, &reqMap)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -22,7 +20,7 @@ func ConvertEmbeddingsRequest(meta *meta.Meta, req *http.Request) (string, http.
|
|
|
|
|
|
|
|
reqMap["model"] = meta.ActualModel
|
|
reqMap["model"] = meta.ActualModel
|
|
|
|
|
|
|
|
- if meta.GetBool(MetaEmbeddingsPatchInputToSlices) {
|
|
|
|
|
|
|
+ if inputToSlices {
|
|
|
switch v := reqMap["input"].(type) {
|
|
switch v := reqMap["input"].(type) {
|
|
|
case string:
|
|
case string:
|
|
|
reqMap["input"] = []string{v}
|
|
reqMap["input"] = []string{v}
|