fix(frontend) : prevent stream cancellation on concurrent message submit (#3878)

* fix: prevent stream cancellation on concurrent message submit

* feat: add i18n support for streaming wait message
This commit is contained in:
Chetan Sharma 2026-07-04 09:06:09 +05:30 committed by GitHub
parent 66b9e7f212
commit 327695b8c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 5 deletions

View File

@ -594,6 +594,10 @@ export function InputBox({
const handleSubmit = useCallback(
async (message: PromptInputMessage) => {
if (status === "streaming") {
toast.info(t.inputBox.pleaseWaitStreaming);
return Promise.reject(new Error("streaming"));
}
const submitAction = getInputSubmitAction({
text: message.text,
fileCount: message.files.length,
@ -607,11 +611,7 @@ export function InputBox({
setFollowupsLoading(false);
const saved = await handleGoalCommand(submitAction.command);
// Only start a run when a goal was actually saved; status/clear never run.
if (
saved &&
submitAction.command.kind === "set" &&
status !== "streaming"
) {
if (saved && submitAction.command.kind === "set") {
return submitThreadMessage({
...message,
text: submitAction.command.objective,
@ -1437,6 +1437,12 @@ export function InputBox({
disabled={disabled}
variant="outline"
status={status}
onClick={(e) => {
if (status === "streaming") {
e.preventDefault();
onStop?.();
}
}}
/>
</PromptInputTools>
</PromptInputFooter>

View File

@ -186,6 +186,7 @@ export const enUS: Translations = {
icon: SparklesIcon,
},
],
pleaseWaitStreaming: "Please wait for the current response to finish.",
},
// Sidebar

View File

@ -127,6 +127,7 @@ export interface Translations {
type: "separator";
}
)[];
pleaseWaitStreaming: string;
};
// Sidebar

View File

@ -178,6 +178,7 @@ export const zhCN: Translations = {
icon: SparklesIcon,
},
],
pleaseWaitStreaming: "请等待当前响应完成。",
},
// Sidebar