From 953f1bdc3caeaf1027f286bbb34e4d93691c96f7 Mon Sep 17 00:00:00 2001 From: CaIon Date: Fri, 1 Aug 2025 18:19:28 +0800 Subject: [PATCH] feat: add admin info to error logging with multi-key support --- controller/relay.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/controller/relay.go b/controller/relay.go index e7318e9b..b5b8f8fe 100644 --- a/controller/relay.go +++ b/controller/relay.go @@ -62,6 +62,14 @@ func relayHandler(c *gin.Context, relayMode int) *types.NewAPIError { other["channel_id"] = channelId other["channel_name"] = c.GetString("channel_name") other["channel_type"] = c.GetInt("channel_type") + adminInfo := make(map[string]interface{}) + adminInfo["use_channel"] = c.GetStringSlice("use_channel") + isMultiKey := common.GetContextKeyBool(c, constant.ContextKeyChannelIsMultiKey) + if isMultiKey { + adminInfo["is_multi_key"] = true + adminInfo["multi_key_index"] = common.GetContextKeyInt(c, constant.ContextKeyChannelMultiKeyIndex) + } + other["admin_info"] = adminInfo model.RecordErrorLog(c, userId, channelId, modelName, tokenName, err.MaskSensitiveError(), tokenId, 0, false, userGroup, other) }