MCPcopy Create free account
hub / github.com/NoFxAiOS/nofx / SanitizeModelConfigForLog

Function SanitizeModelConfigForLog

api/utils.go:21–32  ·  view source on GitHub ↗

SanitizeModelConfigForLog Sanitize model configuration for log output. Takes the same ModelConfigUpdate type used by the request handler so the two can never drift out of sync.

(models map[string]ModelConfigUpdate)

Source from the content-addressed store, hash-verified

19// Takes the same ModelConfigUpdate type used by the request handler so the two
20// can never drift out of sync.
21func SanitizeModelConfigForLog(models map[string]ModelConfigUpdate) map[string]interface{} {
22 safe := make(map[string]interface{})
23 for modelID, cfg := range models {
24 safe[modelID] = map[string]interface{}{
25 "enabled": cfg.Enabled,
26 "api_key": MaskSensitiveString(cfg.APIKey),
27 "custom_api_url": cfg.CustomAPIURL,
28 "custom_model_name": cfg.CustomModelName,
29 }
30 }
31 return safe
32}
33
34// SanitizeExchangeConfigForLog Sanitize exchange configuration for log output.
35// Takes the same ExchangeConfigUpdate type used by the request handler so every

Callers 2

Calls 1

MaskSensitiveStringFunction · 0.85

Tested by 1