Skip to content

Commit

Permalink
Reset editor intent on new chat and empty editor value
Browse files Browse the repository at this point in the history
  • Loading branch information
thenamankumar committed Oct 24, 2024
1 parent e4825cb commit 8767edd
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ export const HumanMessageEditor: FunctionComponent<{
initialIntent || (experimentalOneBoxEnabled ? undefined : 'chat')
)

useEffect(() => {
// reset the input box intent when the editor is cleared
if (isEmptyEditorValue) {
setSubmitIntent(undefined)
}
}, [isEmptyEditorValue])

useEffect(() => {
// set the input box intent when the message is changed or a new chat is created
setSubmitIntent(initialIntent)
}, [initialIntent])

const onSubmitClick = useCallback(
(intent?: ChatMessage['intent']) => {
if (submitState === 'emptyEditorValue') {
Expand Down

0 comments on commit 8767edd

Please sign in to comment.