Fix GlobalChatPane input delay after AI finishes responding

Check for finish_reason in stream chunks to detect when the AI has
finished generating content, and release isLoading immediately rather
than waiting for the stream connection to fully close.
This commit is contained in:
MK Fain committed 2025-12-03 20:56:46 -06:00
1 parent b1bbf58867
commit b78a912af1
1 file changed
+7
+7
View File
@@ -141,6 +141,13 @@ export function GlobalChatProvider({ children }: GlobalChatProviderProps) {
}
return updated;
});
// Check if the stream is finished (finish_reason is set)
const finishReason = chunk.choices[0]?.finish_reason;
if (finishReason) {
// Response is complete, release the input immediately
setIsLoading(false);
}
}
// Final trim after response is complete