fix(plugin): setting the default value of the agent tool does not take effect (#341)
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/getkin/kin-openapi/openapi3"
|
||||
"github.com/mohae/deepcopy"
|
||||
"golang.org/x/mod/semver"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
@@ -59,18 +60,26 @@ var (
|
||||
|
||||
func GetToolProduct(toolID int64) (*ToolInfo, bool) {
|
||||
ti, ok := toolProducts[toolID]
|
||||
return ti, ok
|
||||
if !ok {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
ti_ := deepcopy.Copy(ti).(*ToolInfo)
|
||||
|
||||
return ti_, true
|
||||
}
|
||||
|
||||
func MGetToolProducts(toolIDs []int64) []*ToolInfo {
|
||||
tools := make([]*ToolInfo, 0, len(toolIDs))
|
||||
for _, toolID := range toolIDs {
|
||||
ti, ok := toolProducts[toolID]
|
||||
ti, ok := GetToolProduct(toolID)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
tools = append(tools, ti)
|
||||
}
|
||||
|
||||
return tools
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user