mirror of
https://github.com/langgenius/dify.git
synced 2026-05-13 08:57:28 +08:00
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import {
|
|
memo,
|
|
useCallback,
|
|
} from 'react'
|
|
import { useStore } from '../../store'
|
|
import UserInput from './user-input'
|
|
import { useChat } from './hooks'
|
|
import Chat from '@/app/components/base/chat/chat'
|
|
import type { OnSend } from '@/app/components/base/chat/types'
|
|
|
|
const ChatWrapper = () => {
|
|
const {
|
|
conversationId,
|
|
chatList,
|
|
handleStop,
|
|
isResponding,
|
|
suggestedQuestions,
|
|
handleSend,
|
|
} = useChat()
|
|
|
|
const doSend = useCallback<OnSend>((query, files) => {
|
|
handleSend({
|
|
query,
|
|
files,
|
|
inputs: useStore.getState().inputs,
|
|
conversationId,
|
|
})
|
|
}, [conversationId, handleSend])
|
|
|
|
return (
|
|
<Chat
|
|
chatList={chatList}
|
|
isResponding={isResponding}
|
|
chatContainerclassName='px-4'
|
|
chatContainerInnerClassName='pt-6'
|
|
chatFooterClassName='px-4 rounded-bl-2xl'
|
|
chatFooterInnerClassName='pb-4'
|
|
onSend={doSend}
|
|
onStopResponding={handleStop}
|
|
chatNode={<UserInput />}
|
|
allToolIcons={{}}
|
|
suggestedQuestions={suggestedQuestions}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default memo(ChatWrapper)
|