fix: reset inputs when reset conversation (#16233)

This commit is contained in:
Panpan 2025-03-20 00:17:58 +08:00 • committed by GitHub
commit cade0f65e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 7 deletions

View file

@ -183,7 +183,10 @@ export const useEmbeddedChatbot = () => {
useEffect(() => {
// init inputs from url params
setInitInputs(getProcessedInputsFromUrlParams())
(async () => {
const inputs = await getProcessedInputsFromUrlParams()
setInitInputs(inputs)
})()
}, [])
useEffect(() => {
const conversationInputs: Record<string, any> = {}
@ -288,11 +291,11 @@ export const useEmbeddedChatbot = () => {
if (conversationId)
setClearChatList(false)
}, [handleConversationIdInfoChange, setClearChatList])
const handleNewConversation = useCallback(() => {
const handleNewConversation = useCallback(async () => {
currentChatInstanceRef.current.handleStop()
setShowNewConversationItemInList(true)
handleChangeConversation('')
handleNewConversationInputsChange({})
handleNewConversationInputsChange(await getProcessedInputsFromUrlParams())
setClearChatList(true)
}, [handleChangeConversation, setShowNewConversationItemInList, handleNewConversationInputsChange, setClearChatList])