mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-13 13:04:24 +01:00
fix(stream): detect early abort and prevent navigation to non-existent conversation
- Abort controller on job completion to signal pending operations - Detect early abort (no content, no responseMessageId) in abortJob - Set conversation and responseMessage to null for early aborts - Add earlyAbort flag to final event for frontend detection - Remove unused text field from AbortResult interface - Frontend handles earlyAbort by staying on/navigating to new chat
This commit is contained in:
parent
d9a5893d4b
commit
aa5c18bb29
3 changed files with 44 additions and 32 deletions
|
|
@ -438,6 +438,21 @@ export default function useEventHandlers({
|
|||
} = submission;
|
||||
|
||||
try {
|
||||
// Handle early abort - aborted during tool loading before any messages saved
|
||||
// Don't update conversation state, just reset UI and stay on new chat
|
||||
if ((data as Record<string, unknown>).earlyAbort) {
|
||||
console.log(
|
||||
'[finalHandler] Early abort detected - no messages saved, staying on new chat',
|
||||
);
|
||||
setShowStopButton(false);
|
||||
setIsSubmitting(false);
|
||||
// Navigate to new chat if not already there
|
||||
if (location.pathname !== `/c/${Constants.NEW_CONVO}`) {
|
||||
navigate(`/c/${Constants.NEW_CONVO}`, { replace: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (responseMessage?.attachments && responseMessage.attachments.length > 0) {
|
||||
// Process each attachment through the attachmentHandler
|
||||
responseMessage.attachments.forEach((attachment) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue