From 8399b4199f43be5cd9c6b82389cdeb95521a66b8 Mon Sep 17 00:00:00 2001 From: Se7en Date: Sat, 21 Dec 2024 19:49:24 +0800 Subject: [PATCH] avoid ctxKeyIsStreaming is nil --- plugins/wasm-go/extensions/ai-proxy/provider/failover.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/wasm-go/extensions/ai-proxy/provider/failover.go b/plugins/wasm-go/extensions/ai-proxy/provider/failover.go index 01fbc7f051..e1b0b9819f 100644 --- a/plugins/wasm-go/extensions/ai-proxy/provider/failover.go +++ b/plugins/wasm-go/extensions/ai-proxy/provider/failover.go @@ -543,7 +543,7 @@ func (c *ProviderConfig) OnRequestFailed(activeProvider Provider, ctx wrapper.Ht if c.isFailoverEnabled() { c.handleUnavailableApiToken(ctx, apiTokenInUse, log) } - if c.isRetryOnFailureEnabled() && !ctx.GetContext(ctxKeyIsStreaming).(bool) { + if c.isRetryOnFailureEnabled() && ctx.GetContext(ctxKeyIsStreaming) != nil && !ctx.GetContext(ctxKeyIsStreaming).(bool) { c.retryFailedRequest(activeProvider, ctx, log) return types.HeaderStopAllIterationAndWatermark }