mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
feat(agent): Adds prologue functionality (#9336)
### What problem does this PR solve? feat(agent): Adds prologue functionality #3221 - Add a prologue field to the IInputs type - Initialize the prologue state in the chat container - Use useEffect to monitor prologue changes and add prologue responses ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -361,5 +361,6 @@ export const useSendAgentMessage = (
|
|||||||
resetSession,
|
resetSession,
|
||||||
findReferenceByMessageId,
|
findReferenceByMessageId,
|
||||||
appendUploadResponseList,
|
appendUploadResponseList,
|
||||||
|
addNewestOneAnswer,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -38,4 +38,5 @@ export type IInputs = {
|
|||||||
avatar: string;
|
avatar: string;
|
||||||
title: string;
|
title: string;
|
||||||
inputs: Record<string, BeginQuery>;
|
inputs: Record<string, BeginQuery>;
|
||||||
|
prologue: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -60,6 +60,7 @@ const ChatContainer = () => {
|
|||||||
parameterDialogVisible,
|
parameterDialogVisible,
|
||||||
showParameterDialog,
|
showParameterDialog,
|
||||||
sendFormMessage,
|
sendFormMessage,
|
||||||
|
addNewestOneAnswer,
|
||||||
ok,
|
ok,
|
||||||
resetSession,
|
resetSession,
|
||||||
} = useSendNextSharedMessage(addEventList);
|
} = useSendNextSharedMessage(addEventList);
|
||||||
@ -75,6 +76,7 @@ const ChatContainer = () => {
|
|||||||
avatar: '',
|
avatar: '',
|
||||||
title: '',
|
title: '',
|
||||||
inputs: {},
|
inputs: {},
|
||||||
|
prologue: '',
|
||||||
});
|
});
|
||||||
const handleUploadFile: NonNullable<FileUploadProps['onUpload']> =
|
const handleUploadFile: NonNullable<FileUploadProps['onUpload']> =
|
||||||
useCallback(
|
useCallback(
|
||||||
@ -97,9 +99,18 @@ const ChatContainer = () => {
|
|||||||
avatar,
|
avatar,
|
||||||
title,
|
title,
|
||||||
inputs: inputs,
|
inputs: inputs,
|
||||||
|
prologue: '',
|
||||||
});
|
});
|
||||||
}, [inputsData, setAgentInfo]);
|
}, [inputsData, setAgentInfo]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (inputsData.prologue) {
|
||||||
|
addNewestOneAnswer({
|
||||||
|
answer: inputsData.prologue,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [inputsData.prologue, addNewestOneAnswer]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (inputsData && inputsData.inputs && !isEmpty(inputsData.inputs)) {
|
if (inputsData && inputsData.inputs && !isEmpty(inputsData.inputs)) {
|
||||||
showParameterDialog();
|
showParameterDialog();
|
||||||
|
|||||||
Reference in New Issue
Block a user