feat: Add user variable processing function to chat history (#22863)

This commit is contained in:
croatialu
2025-07-24 10:06:49 +08:00
committed by GitHub
parent ef51678c73
commit d1572f47a0
5 changed files with 37 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ import SuggestedQuestions from '@/app/components/base/chat/chat/answer/suggested
import { Markdown } from '@/app/components/base/markdown'
import cn from '@/utils/classnames'
import type { FileEntity } from '../../file-uploader/types'
import Avatar from '../../avatar'
const ChatWrapper = () => {
const {
@@ -48,6 +49,7 @@ const ChatWrapper = () => {
setClearChatList,
setIsResponding,
allInputsHidden,
initUserVariables,
} = useChatWithHistoryContext()
const appConfig = useMemo(() => {
const config = appParams || {}
@@ -119,7 +121,6 @@ const ChatWrapper = () => {
useEffect(() => {
if (currentChatInstanceRef.current)
currentChatInstanceRef.current.handleStop = handleStop
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
useEffect(() => {
@@ -238,7 +239,7 @@ const ChatWrapper = () => {
className='h-full overflow-hidden bg-chatbot-bg'
>
<Chat
appData={appData}
appData={appData ?? undefined}
config={appConfig}
chatList={messageList}
isResponding={respondingState}
@@ -266,6 +267,14 @@ const ChatWrapper = () => {
inputDisabled={inputDisabled}
isMobile={isMobile}
sidebarCollapseState={sidebarCollapseState}
questionIcon={
initUserVariables?.avatar_url
? <Avatar
avatar={initUserVariables.avatar_url}
name={initUserVariables.name || 'user'}
size={40}
/> : undefined
}
/>
</div>
)