How to detect when sendFollowUpMessage actually finishes its response?

Hi, I’m using window.openai.sendFollowUpMessage in my widget.

The issue is that the Promise returned by this function resolves immediately (0.0s), long before GPT even starts or finishes writing the response.

JavaScript

// It resolves instantly, regardless of the GPT's response status
await window.openai.sendFollowUpMessage({ prompt: "..." });
console.log("Resolved!"); // This prints almost at the same time as the call

Is there any way to know when GPT has completely finished generating the response? I need to sync my UI with the end of the message.

Is there a specific callback or an event listener for this?

5 Likes