feat: show citation info in run history (#3399)

This commit is contained in:
Nite Knite 2024-04-12 12:19:27 +08:00 committed by GitHub
parent b00466f025
commit c9abb75fce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 11 deletions

View File

@ -121,7 +121,7 @@ const ChatItem: FC<ChatItemProps> = ({
isResponding={isResponding}
noChatInput
noStopResponding
chatContainerclassName='p-4'
chatContainerClassName='p-4'
chatFooterClassName='p-4 pb-0'
suggestedQuestions={suggestedQuestions}
onSend={doSend}

View File

@ -119,7 +119,7 @@ const DebugWithSingleModel = forwardRef<DebugWithSingleModelRefType, DebugWithSi
config={config}
chatList={chatList}
isResponding={isResponding}
chatContainerclassName='p-6'
chatContainerClassName='p-6'
chatFooterClassName='px-6 pt-10 pb-4'
suggestedQuestions={suggestedQuestions}
onSend={doSend}

View File

@ -163,8 +163,8 @@ const Answer: FC<AnswerProps> = ({
}
<SuggestedQuestions item={item} />
{
!!citation?.length && config?.retriever_resource?.enabled && !responding && (
<Citation data={citation} showHitInfo={config.supportCitationHitInfo} />
!!citation?.length && !responding && (
<Citation data={citation} showHitInfo={config?.supportCitationHitInfo} />
)
}
</div>

View File

@ -11,6 +11,7 @@ import {
} from 'react'
import { useTranslation } from 'react-i18next'
import { debounce } from 'lodash-es'
import classNames from 'classnames'
import type {
ChatConfig,
ChatItem,
@ -36,7 +37,7 @@ export type ChatProps = {
onStopResponding?: () => void
noChatInput?: boolean
onSend?: OnSend
chatContainerclassName?: string
chatContainerClassName?: string
chatContainerInnerClassName?: string
chatFooterClassName?: string
chatFooterInnerClassName?: string
@ -60,7 +61,7 @@ const Chat: FC<ChatProps> = ({
noStopResponding,
onStopResponding,
noChatInput,
chatContainerclassName,
chatContainerClassName,
chatContainerInnerClassName,
chatFooterClassName,
chatFooterInnerClassName,
@ -171,7 +172,7 @@ const Chat: FC<ChatProps> = ({
<div className='relative h-full'>
<div
ref={chatContainerRef}
className={`relative h-full overflow-y-auto ${chatContainerclassName}`}
className={classNames('relative h-full overflow-y-auto', chatContainerClassName)}
>
{chatNode}
<div

View File

@ -35,7 +35,7 @@ const ChatRecord = () => {
content: item.answer,
feedback: item.feedback,
isAnswer: true,
citation: item.retriever_resources,
citation: item.metadata?.retriever_resources,
message_files: item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || [],
workflow_run_id: item.workflow_run_id,
})
@ -82,9 +82,11 @@ const ChatRecord = () => {
</div>
<div className='grow h-0'>
<Chat
config={{} as any}
config={{
supportCitationHitInfo: true,
} as any}
chatList={chatMessageList}
chatContainerclassName='px-4'
chatContainerClassName='px-4'
chatContainerInnerClassName='pt-6'
chatFooterClassName='px-4 rounded-b-2xl'
chatFooterInnerClassName='pb-4'

View File

@ -94,7 +94,7 @@ const ChatWrapper = forwardRef<ChatWrapperRefType>((_, ref) => {
} as any}
chatList={chatList}
isResponding={isResponding}
chatContainerclassName='px-4'
chatContainerClassName='px-4'
chatContainerInnerClassName='pt-6'
chatFooterClassName='px-4 rounded-bl-2xl'
chatFooterInnerClassName='pb-4'