update dialog position, and clear feedback content after dialog disappear

This commit is contained in:
Henry
2024-03-12 18:46:34 +08:00
parent f16254203e
commit 2853b3149b
2 changed files with 9 additions and 6 deletions
@@ -27,7 +27,10 @@ const ChatFeedbackContentDialog = ({ show, onCancel, onConfirm }) => {
useEffect(() => {
if (show) dispatch({ type: SHOW_CANVAS_DIALOG })
else dispatch({ type: HIDE_CANVAS_DIALOG })
return () => dispatch({ type: HIDE_CANVAS_DIALOG })
return () => {
dispatch({ type: HIDE_CANVAS_DIALOG })
setFeedbackContent('')
}
}, [show, dispatch])
const component = show ? (
@@ -871,11 +871,6 @@ export const ChatMessage = ({ open, chatflowid, isDialog, previews, setPreviews
/>
) : null}
</Box>
<ChatFeedbackContentDialog
show={showFeedbackContentDialog}
onCancel={() => setShowFeedbackContentDialog(false)}
onConfirm={submitFeedbackContent}
/>
</>
) : null}
{message.fileAnnotations && (
@@ -1124,6 +1119,11 @@ export const ChatMessage = ({ open, chatflowid, isDialog, previews, setPreviews
)}
</div>
<SourceDocDialog show={sourceDialogOpen} dialogProps={sourceDialogProps} onCancel={() => setSourceDialogOpen(false)} />
<ChatFeedbackContentDialog
show={showFeedbackContentDialog}
onCancel={() => setShowFeedbackContentDialog(false)}
onConfirm={submitFeedbackContent}
/>
</div>
)
}