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,
|
||||
findReferenceByMessageId,
|
||||
appendUploadResponseList,
|
||||
addNewestOneAnswer,
|
||||
};
|
||||
};
|
||||
|
||||
@ -38,4 +38,5 @@ export type IInputs = {
|
||||
avatar: string;
|
||||
title: string;
|
||||
inputs: Record<string, BeginQuery>;
|
||||
prologue: string;
|
||||
};
|
||||
|
||||
@ -60,6 +60,7 @@ const ChatContainer = () => {
|
||||
parameterDialogVisible,
|
||||
showParameterDialog,
|
||||
sendFormMessage,
|
||||
addNewestOneAnswer,
|
||||
ok,
|
||||
resetSession,
|
||||
} = useSendNextSharedMessage(addEventList);
|
||||
@ -75,6 +76,7 @@ const ChatContainer = () => {
|
||||
avatar: '',
|
||||
title: '',
|
||||
inputs: {},
|
||||
prologue: '',
|
||||
});
|
||||
const handleUploadFile: NonNullable<FileUploadProps['onUpload']> =
|
||||
useCallback(
|
||||
@ -97,9 +99,18 @@ const ChatContainer = () => {
|
||||
avatar,
|
||||
title,
|
||||
inputs: inputs,
|
||||
prologue: '',
|
||||
});
|
||||
}, [inputsData, setAgentInfo]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (inputsData.prologue) {
|
||||
addNewestOneAnswer({
|
||||
answer: inputsData.prologue,
|
||||
});
|
||||
}
|
||||
}, [inputsData.prologue, addNewestOneAnswer]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (inputsData && inputsData.inputs && !isEmpty(inputsData.inputs)) {
|
||||
showParameterDialog();
|
||||
|
||||
Reference in New Issue
Block a user