MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / getKeys

Method getKeys

model/channel.go:70–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68}
69
70func (channel *Channel) getKeys() []string {
71 if channel.Key == "" {
72 return []string{}
73 }
74 trimmed := strings.TrimSpace(channel.Key)
75 // If the key starts with '[', try to parse it as a JSON array (e.g., for Vertex AI scenarios)
76 if strings.HasPrefix(trimmed, "[") {
77 var arr []json.RawMessage
78 if err := json.Unmarshal([]byte(trimmed), &arr); err == nil {
79 res := make([]string, len(arr))
80 for i, v := range arr {
81 res[i] = string(v)
82 }
83 return res
84 }
85 }
86 // Otherwise, fall back to splitting by newline
87 keys := strings.Split(strings.Trim(channel.Key, "\n"), "\n")
88 return keys
89}
90
91func (channel *Channel) GetNextEnabledKey() (string, int, *types.NewAPIError) {
92 // If not in multi-key mode, return the original key string directly.

Callers 2

GetNextEnabledKeyMethod · 0.95
handlerMultiKeyUpdateFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected