MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / expandConfigPlaceholders

Function expandConfigPlaceholders

internal/tools/configwriter.go:64–73  ·  view source on GitHub ↗

expandConfigPlaceholders substitutes the five recognised placeholders. It is a superset of expandPlaceholders in launch.go (adds {endpoint_name} and {model_2}; model_2 is empty until callers thread a secondary model in).

(raw string, ep providers.Endpoint, endpointName, model, apiKey string)

Source from the content-addressed store, hash-verified

62// is a superset of expandPlaceholders in launch.go (adds {endpoint_name} and
63// {model_2}; model_2 is empty until callers thread a secondary model in).
64func expandConfigPlaceholders(raw string, ep providers.Endpoint, endpointName, model, apiKey string) string {
65 s := raw
66 s = strings.ReplaceAll(s, "{endpoint}", ep.Endpoint)
67 s = strings.ReplaceAll(s, "{endpoint_name}", endpointName)
68 s = strings.ReplaceAll(s, "{api_key_env}", providers.ResolveAPIKeyEnv(ep, endpointName))
69 s = strings.ReplaceAll(s, "{api_key}", apiKey)
70 s = strings.ReplaceAll(s, "{selected_model}", model)
71 s = strings.ReplaceAll(s, "{model_2}", "")
72 return s
73}
74
75// coerceScalar promotes a raw string into the most specific Go type that fits.
76// Order: bool > int64 > float64 > string. Reuses editorconfig.ParseScalar

Callers 1

PlanFunction · 0.85

Calls 1

ResolveAPIKeyEnvFunction · 0.92

Tested by

no test coverage detected