fix(web): self-heal stuck Cancel send button

This commit is contained in:
zhayujie
2026-06-08 15:48:21 +08:00
parent b7aa64279d
commit 7cf0f7d42d

View File

@@ -1298,8 +1298,15 @@ sendBtn.addEventListener('click', () => {
function updateSendBtnState() {
if (sendBtnMode === 'cancel') {
// Don't downgrade a Cancel button on input edits.
return;
// Self-heal a stuck Cancel button: if there's no live stream backing
// the current request, the cancel state leaked (e.g. a stream ended
// without resetting). Recover to Send so the input isn't blocked.
if (!activeRequestId || !activeStreams[activeRequestId]) {
resetSendBtnSendMode();
} else {
// Don't downgrade a genuinely active Cancel button on input edits.
return;
}
}
sendBtn.disabled = uploadingCount > 0 || (!chatInput.value.trim() && pendingAttachments.length === 0);
}