fix: Bypass the response body processing in ai-proxy if it is returned internally (#1149)

This commit is contained in:
Kent Dong
2024-07-24 16:18:00 +08:00
committed by GitHub
parent 9a9e924037
commit f6ee4ed166
4 changed files with 36 additions and 1 deletions

View File

@@ -111,6 +111,12 @@ func onHttpRequestBody(ctx wrapper.HttpContext, pluginConfig config.PluginConfig
}
func onHttpResponseHeaders(ctx wrapper.HttpContext, pluginConfig config.PluginConfig, log wrapper.Log) types.Action {
if !wrapper.IsResponseFromUpstream() {
// Response is not coming from the upstream. Let it pass through.
ctx.DontReadResponseBody()
return types.ActionContinue
}
activeProvider := pluginConfig.GetProvider()
if activeProvider == nil {