Skip to content

Commit 27328a5

Browse files
jessicasingh7justin-tahara
authored andcommitted
fix(federated-slack): pass in valid query (#5402)
1 parent e024472 commit 27328a5

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

web/src/app/chat/hooks/useChatController.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,12 @@ export function useChatController({
291291
}
292292
}
293293

294+
// Reset all relevant state to ensure clean state for new requests
294295
updateChatStateAction(currentSession, "input");
296+
updateCanContinue(false, currentSession);
297+
setUncaughtError(currentSession, null);
298+
setLoadingError(currentSession, null);
299+
resetRegenerationState(currentSession);
295300
}, [currentMessageHistory, currentMessageTree]);
296301

297302
const onSubmit = useCallback(
@@ -399,14 +404,24 @@ export function useChatController({
399404
message: "Please wait for the content to upload",
400405
type: "error",
401406
});
407+
} else if (
408+
currentChatState == "streaming" ||
409+
currentChatState == "loading"
410+
) {
411+
// If we're in streaming/loading state, it might be a stale state after stopping
412+
// Force reset the state to input to allow new requests
413+
updateChatStateAction(frozenSessionId, "input");
414+
updateCanContinue(false, frozenSessionId);
415+
setUncaughtError(frozenSessionId, null);
416+
setLoadingError(frozenSessionId, null);
417+
resetRegenerationState(frozenSessionId);
402418
} else {
403419
setPopup({
404420
message: "Please wait for the response to complete",
405421
type: "error",
406422
});
423+
return;
407424
}
408-
409-
return;
410425
}
411426

412427
clientScrollToBottom();

0 commit comments

Comments
 (0)