Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🏄‍♂️ refactor: Improve Cancelled Stream Handling for Pending Authentication (#9235)

Danny Avila939af59950b9
diff --git a/client/src/hooks/SSE/useEventHandlers.ts b/client/src/hooks/SSE/useEventHandlers.ts
index 5d459b844c..1d860fbb7a 100644
--- a/client/src/hooks/SSE/useEventHandlers.ts
+++ b/client/src/hooks/SSE/useEventHandlers.ts
@@ -480,12 +480,13 @@ export default function useEventHandlers({
queryClient.setQueryData<TMessage[]>([QueryKeys.messages, id], _messages);
};
- /** Handle edge case where stream is cancelled before any response, which creates a blank page */
- if (
- !conversation.conversationId &&
+ const hasNoResponse =
responseMessage?.content?.[0]?.['text']?.value ===
- submission.initialResponse?.content?.[0]?.['text']?.value
- ) {
+ submission.initialResponse?.content?.[0]?.['text']?.value ||
+ !!responseMessage?.content?.[0]?.['tool_call']?.auth;
+
+ /** Handle edge case where stream is cancelled before any response, which creates a blank page */
+ if (!conversation.conversationId && hasNoResponse) {
const currentConvoId =
(submissionConvo.conversationId ?? conversation.conversationId) || Constants.NEW_CONVO;
if (isNewConvo && submissionConvo.conversationId) {