MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / GenConfig

Method GenConfig

ai-provider/model-runtime/param.go:22–50  ·  view source on GitHub ↗
(target map[string]interface{}, origin map[string]interface{})

Source from the content-addressed store, hash-verified

20type ParamValidator []Param
21
22func (p ParamValidator) GenConfig(target map[string]interface{}, origin map[string]interface{}) (string, error) {
23 for _, rule := range p {
24 if !rule.Secret {
25 continue
26 }
27 vv, ok := origin[rule.Name]
28 if !ok {
29 continue
30 }
31 v, ok := vv.(string)
32 if !ok || v == "******" {
33 continue
34 }
35 tv, ok := target[rule.Name]
36 if !ok {
37 continue
38 }
39 v, ok = tv.(string)
40 if !ok || v == "******" {
41 target[rule.Name] = origin[rule.Name]
42 }
43
44 }
45 data, err := json.Marshal(target)
46 if err != nil {
47 return "", err
48 }
49 return string(data), nil
50}
51
52type Param struct {
53 Name string `json:"name" yaml:"name"`

Callers

nothing calls this directly

Calls 1

MarshalMethod · 0.80

Tested by

no test coverage detected