mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-07-25 15:37:53 +00:00
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:
parent
66b9e7f212
commit
327695b8c5
@ -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>
|
||||
|
||||
@ -186,6 +186,7 @@ export const enUS: Translations = {
|
||||
icon: SparklesIcon,
|
||||
},
|
||||
],
|
||||
pleaseWaitStreaming: "Please wait for the current response to finish.",
|
||||
},
|
||||
|
||||
// Sidebar
|
||||
|
||||
@ -127,6 +127,7 @@ export interface Translations {
|
||||
type: "separator";
|
||||
}
|
||||
)[];
|
||||
pleaseWaitStreaming: string;
|
||||
};
|
||||
|
||||
// Sidebar
|
||||
|
||||
@ -178,6 +178,7 @@ export const zhCN: Translations = {
|
||||
icon: SparklesIcon,
|
||||
},
|
||||
],
|
||||
pleaseWaitStreaming: "请等待当前响应完成。",
|
||||
},
|
||||
|
||||
// Sidebar
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user