mirror of
https://github.com/mudler/LocalAI.git
synced 2026-04-04 15:04:27 -04:00
fix(input): handle correctly case where we pass by string list as inputs (#5521)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
committed by
GitHub
parent
6073b9944e
commit
0870bf5af6
@@ -383,17 +383,28 @@ func mergeOpenAIRequestAndBackendConfig(config *config.BackendConfig, input *sch
|
||||
if inputs != "" {
|
||||
config.InputStrings = append(config.InputStrings, inputs)
|
||||
}
|
||||
case []interface{}:
|
||||
case []any:
|
||||
for _, pp := range inputs {
|
||||
switch i := pp.(type) {
|
||||
case string:
|
||||
config.InputStrings = append(config.InputStrings, i)
|
||||
case []interface{}:
|
||||
case []any:
|
||||
tokens := []int{}
|
||||
inputStrings := []string{}
|
||||
for _, ii := range i {
|
||||
tokens = append(tokens, int(ii.(float64)))
|
||||
switch ii := ii.(type) {
|
||||
case int:
|
||||
tokens = append(tokens, ii)
|
||||
case float64:
|
||||
tokens = append(tokens, int(ii))
|
||||
case string:
|
||||
inputStrings = append(inputStrings, ii)
|
||||
default:
|
||||
log.Error().Msgf("Unknown input type: %T", ii)
|
||||
}
|
||||
}
|
||||
config.InputToken = append(config.InputToken, tokens)
|
||||
config.InputStrings = append(config.InputStrings, inputStrings...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user