Feat: Call the interface to stop the output of the large model #10997 (#11164)

### What problem does this PR solve?

Feat: Call the interface to stop the output of the large model #10997

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-11-11 15:21:08 +08:00
committed by GitHub
parent 7dd9758056
commit 377c0fb4fa
8 changed files with 84 additions and 5 deletions

View File

@ -35,6 +35,7 @@ import {
useIsTaskMode,
useSelectBeginNodeDataInputs,
} from '../hooks/use-get-begin-query';
import { useStopMessage } from '../hooks/use-stop-message';
import { BeginQuery } from '../interface';
import useGraphStore from '../store';
import { receiveMessageError } from '../utils';
@ -243,6 +244,14 @@ export const useSendAgentMessage = ({
fileList,
} = useSetUploadResponseData();
const { stopMessage } = useStopMessage();
const stopConversation = useCallback(() => {
const taskId = answerList.at(0)?.task_id;
stopOutputMessage();
stopMessage(taskId);
}, [answerList, stopMessage, stopOutputMessage]);
const sendMessage = useCallback(
async ({
message,
@ -321,7 +330,7 @@ export const useSendAgentMessage = ({
// reset session
const resetSession = useCallback(() => {
stopOutputMessage();
stopConversation();
resetAnswerList();
setSessionId(null);
if (isTaskMode) {
@ -330,7 +339,7 @@ export const useSendAgentMessage = ({
removeAllMessagesExceptFirst();
}
}, [
stopOutputMessage,
stopConversation,
resetAnswerList,
isTaskMode,
removeAllMessages,
@ -432,7 +441,7 @@ export const useSendAgentMessage = ({
handlePressEnter,
handleInputChange,
removeMessageById,
stopOutputMessage,
stopOutputMessage: stopConversation,
send,
sendFormMessage,
resetSession,