fix: isStream status in error logs instead of hardcoded false (#4195)

This commit is contained in:
skynono
2026-04-12 17:41:26 +08:00
committed by GitHub
parent 59c582d13c
commit b4df9955f4
3 changed files with 3 additions and 1 deletions
+1
View File
@@ -65,4 +65,5 @@ const (
// ContextKeyLanguage stores the user's language preference for i18n // ContextKeyLanguage stores the user's language preference for i18n
ContextKeyLanguage ContextKey = "language" ContextKeyLanguage ContextKey = "language"
ContextKeyIsStream ContextKey = "is_stream"
) )
+1 -1
View File
@@ -389,7 +389,7 @@ func processChannelError(c *gin.Context, channelError types.ChannelError, err *t
startTime = time.Now() startTime = time.Now()
} }
useTimeSeconds := int(time.Since(startTime).Seconds()) useTimeSeconds := int(time.Since(startTime).Seconds())
model.RecordErrorLog(c, userId, channelId, modelName, tokenName, err.MaskSensitiveErrorWithStatusCode(), tokenId, useTimeSeconds, false, userGroup, other) model.RecordErrorLog(c, userId, channelId, modelName, tokenName, err.MaskSensitiveErrorWithStatusCode(), tokenId, useTimeSeconds, common.GetContextKeyBool(c, constant.ContextKeyIsStream), userGroup, other)
} }
} }
+1
View File
@@ -438,6 +438,7 @@ func genBaseRelayInfo(c *gin.Context, request dto.Request) *RelayInfo {
if request != nil { if request != nil {
isStream = request.IsStream(c) isStream = request.IsStream(c)
} }
c.Set(string(constant.ContextKeyIsStream), isStream)
// firstResponseTime = time.Now() - 1 second // firstResponseTime = time.Now() - 1 second