@@ -104,11 +104,11 @@ func onHttpRequestBody(ctx wrapper.HttpContext, c config.PluginConfig, body []by
104
104
key = strings .Join (userMessages , "\n " )
105
105
} else if c .CacheKeyStrategy == config .CACHE_KEY_STRATEGY_DISABLED {
106
106
log .Info ("[onHttpRequestBody] cache key strategy is disabled" )
107
- ctx .DontReadRequestBody ()
107
+ ctx .DontReadResponseBody ()
108
108
return types .ActionContinue
109
109
} else {
110
110
log .Warnf ("[onHttpRequestBody] unknown cache key strategy: %s" , c .CacheKeyStrategy )
111
- ctx .DontReadRequestBody ()
111
+ ctx .DontReadResponseBody ()
112
112
return types .ActionContinue
113
113
}
114
114
@@ -147,19 +147,14 @@ func onHttpResponseHeaders(ctx wrapper.HttpContext, c config.PluginConfig, log w
147
147
ctx .SetResponseBodyBufferLimit (DEFAULT_MAX_BODY_BYTES )
148
148
}
149
149
150
- if ctx .GetContext (ERROR_PARTIAL_MESSAGE_KEY ) != nil {
151
- ctx .DontReadResponseBody ()
152
- return types .ActionContinue
153
- }
154
-
155
150
return types .ActionContinue
156
151
}
157
152
158
153
func onHttpResponseBody (ctx wrapper.HttpContext , c config.PluginConfig , chunk []byte , isLastChunk bool , log wrapper.Log ) []byte {
159
154
log .Debugf ("[onHttpResponseBody] is last chunk: %v" , isLastChunk )
160
155
log .Debugf ("[onHttpResponseBody] chunk: %s" , string (chunk ))
161
156
162
- if ctx .GetContext (TOOL_CALLS_CONTEXT_KEY ) != nil {
157
+ if ctx .GetContext (TOOL_CALLS_CONTEXT_KEY ) != nil || ctx . GetContext ( ERROR_PARTIAL_MESSAGE_KEY ) != nil {
163
158
return chunk
164
159
}
165
160
0 commit comments