Commit b4df9955 by skynono Committed by GitHub

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

parent 59c582d1
...@@ -65,4 +65,5 @@ const ( ...@@ -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"
) )
...@@ -389,7 +389,7 @@ func processChannelError(c *gin.Context, channelError types.ChannelError, err *t ...@@ -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)
} }
} }
......
...@@ -438,6 +438,7 @@ func genBaseRelayInfo(c *gin.Context, request dto.Request) *RelayInfo { ...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment