MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin-Playground / getkey

Function getkey

plugin/chatgpt/model.go:221–238  ·  view source on GitHub ↗
(ctx *zero.Ctx)

Source from the content-addressed store, hash-verified

219}
220
221func getkey(ctx *zero.Ctx) (key string, err error) {
222 // 先从群聊中查找API Key
223 if ctx.Event.GroupID != 0 {
224 if key, err = db.findgkey(ctx.Event.GroupID); err == nil {
225 return key, nil
226 }
227 }
228 // 再从个人中查找API Key
229 if key, err = db.findkey(-ctx.Event.UserID); err == nil {
230 return key, nil
231 }
232 // 最后从全局中查找API Key
233 if key, err = db.findgkey(-1); err == nil {
234 return key, nil
235 }
236 // 如果都没有设置则会返回错误提示
237 return "", err
238}

Callers 1

initFunction · 0.85

Calls 2

findgkeyMethod · 0.80
findkeyMethod · 0.80

Tested by

no test coverage detected