mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-20 10:35:01 +00:00
feat(functions): don't use yaml.MapSlice (#2354)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
7a480bb16f
commit
5a6d120a56
2 changed files with 11 additions and 8 deletions
|
@ -4,7 +4,6 @@ import (
|
|||
. "github.com/go-skynet/LocalAI/pkg/functions"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
var _ = Describe("LocalAI function parse tests", func() {
|
||||
|
@ -121,7 +120,7 @@ Some text before the JSON
|
|||
Some text after the JSON
|
||||
`
|
||||
|
||||
functionConfig.ReplaceResults = yaml.MapSlice{
|
||||
functionConfig.ReplaceResults = []ReplaceResult{
|
||||
{Key: `(?s)^[^{\[]*`, Value: ""},
|
||||
{Key: `(?s)[^}\]]*$`, Value: ""},
|
||||
}
|
||||
|
@ -138,7 +137,7 @@ Some text before the JSON
|
|||
[{"function": "add", "arguments": {"x": 5, "y": 3}}, {"function": "subtract", "arguments": {"x": 10, "y": 7}}]
|
||||
Some text after the JSON
|
||||
`
|
||||
functionConfig.ReplaceResults = yaml.MapSlice{
|
||||
functionConfig.ReplaceResults = []ReplaceResult{
|
||||
{Key: `(?s)^[^{\[]*`, Value: ""},
|
||||
{Key: `(?s)[^}\]]*$`, Value: ""},
|
||||
}
|
||||
|
@ -164,7 +163,7 @@ Some text after the JSON
|
|||
// Regex to match non-JSON characters after the JSON structure
|
||||
//reAfter := regexp.MustCompile(`(?s)(?<=\}|\]).*$`)
|
||||
|
||||
functionConfig.ReplaceResults = yaml.MapSlice{
|
||||
functionConfig.ReplaceResults = []ReplaceResult{
|
||||
{Key: `(?s)^[^{\[]*`, Value: ""},
|
||||
{Key: `(?s)[^}\]]*$`, Value: ""},
|
||||
// Regex pattern to match single quotes around keys and values
|
||||
|
@ -197,7 +196,7 @@ Some text after the JSON
|
|||
// Regex to match non-JSON characters after the JSON structure
|
||||
//reAfter := regexp.MustCompile(`(?s)(?<=\}|\]).*$`)
|
||||
|
||||
functionConfig.ReplaceResults = yaml.MapSlice{
|
||||
functionConfig.ReplaceResults = []ReplaceResult{
|
||||
{Key: `(?s)^[^{\[]*`, Value: ""},
|
||||
{Key: `(?s)[^}\]]*$`, Value: ""},
|
||||
// Regex pattern to match single quotes around keys and values
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue