Allow stalled chat uploads to be cancelled

This commit is contained in:
pewdiepie-archdaemon
2026-06-29 02:06:39 +00:00
parent b419caf9f7
commit e2c8b8eb37
2 changed files with 56 additions and 1 deletions
+12
View File
@@ -292,6 +292,9 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
// If currently streaming, stop it
if (isStreaming) {
if (fileHandlerModule.isUploading && fileHandlerModule.isUploading()) {
fileHandlerModule.cancelUpload && fileHandlerModule.cancelUpload();
}
// Cancel server-side research if in progress
const _cancelSid = sessionModule.getCurrentSessionId();
if (_cancelSid && _researchingStreamIds.has(_cancelSid)) {
@@ -687,6 +690,15 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
} catch(e) {
console.error('upload failed', e);
}
if (_pendingAttachInfo && !ids.length && !(_pendingRegenAttachments && _pendingRegenAttachments.length)) {
if (_userMsgEl && _userMsgEl.parentNode) _userMsgEl.remove();
if (fileHandlerModule.wasLastUploadCancelled && !fileHandlerModule.wasLastUploadCancelled()) {
uiModule.showError && uiModule.showError('Upload failed. Attachment kept so you can retry.');
}
updateSubmitButton('idle', submitBtn);
_releaseSendFlag();
return;
}
// Carry over the original message's file-ids on a regenerate so the new
// send still references the same photos / docs (and picks up the user's