mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-24 15:57:04 +00:00
Image generation requests (forwardOpenAIImagesOAuth and forwardOpenAIImagesAPIKey) were calling detachStreamUpstreamContext with parsed.Stream, which for non-streaming requests (Stream=false) simply returned the original client context unchanged. When the client disconnected before the upstream completed (30-80s for image gen), the context cancellation propagated to the upstream HTTP request, causing a 502 error despite the upstream having already started processing. Switch to detachUpstreamContext (unconditional detach) so the upstream image generation request is always bound to a background context and completes regardless of client lifecycle. Fixes #2310