There is a bug in the ai-widget.
Scenario:
- The first response from the chat function call returns with status: "error".
- The user clicks Regenerate, and the new response returns with status: "success".
- Expected behavior: the accept and reject buttons should appear.
- Actual behavior: the buttons do not appear.
Workaround
If it's a success response from LLM API calling, do this:
const acceptBtn = document?.querySelector(
'button#cm-ai-prompt-btn-accept'
) as HTMLButtonElement;
if (acceptBtn) {
acceptBtn.style.display = 'initial';
}
const discardBtn = document?.querySelector(
'button#cm-ai-prompt-btn-discard'
) as HTMLButtonElement;
if (discardBtn) {
discardBtn.style.display = 'initial';
}