fix(plugin): setting the default value of the agent tool does not take effect (#341)

This commit is contained in:
mrh997
2025-07-30 22:51:16 +08:00
committed by GitHub
parent 357da72a52
commit 9660a85454
7 changed files with 115 additions and 46 deletions

View File

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