Fix:webapp UI issues (#15601)

This commit is contained in:
KVOJJJin
2025-03-13 14:23:41 +08:00
committed by GitHub
parent 5e035a4209
commit efebbffe96
17 changed files with 182 additions and 50 deletions

View File

@@ -110,7 +110,7 @@ const Answer: FC<AnswerProps> = ({
</div>
)}
</div>
<div className='chat-answer-container group grow w-0 ml-4' ref={containerRef}>
<div className='chat-answer-container group grow w-0 ml-4 pb-4' ref={containerRef}>
<div className={cn('group relative pr-10', chatAnswerContainerInner)}>
<div
ref={contentRef}

View File

@@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next'
import {
RiClipboardLine,
RiEditLine,
RiReplay15Line,
RiResetLeftLine,
RiThumbDownLine,
RiThumbUpLine,
} from '@remixicon/react'
@@ -130,7 +130,7 @@ const Operation: FC<OperationProps> = ({
</ActionButton>
{!noChatInput && (
<ActionButton onClick={() => onRegenerate?.(item)}>
<RiReplay15Line className='w-4 h-4' />
<RiResetLeftLine className='w-4 h-4' />
</ActionButton>
)}
{(config?.supportAnnotation && config.annotation_reply?.enabled) && (

View File

@@ -51,6 +51,8 @@ export const useChat = (
},
prevChatTree?: ChatItemInTree[],
stopChat?: (taskId: string) => void,
clearChatList?: boolean,
clearChatListCallback?: (state: boolean) => void,
) => {
const { t } = useTranslation()
const { formatTime } = useTimestamp()
@@ -90,7 +92,7 @@ export const useChat = (
}
else {
ret.unshift({
id: `${Date.now()}`,
id: 'opening-statement',
content: getIntroduction(config.opening_statement),
isAnswer: true,
isOpeningStatement: true,
@@ -163,12 +165,13 @@ export const useChat = (
suggestedQuestionsAbortControllerRef.current.abort()
}, [stopChat, handleResponding])
const handleRestart = useCallback(() => {
const handleRestart = useCallback((cb?: any) => {
conversationId.current = ''
taskIdRef.current = ''
handleStop()
setChatTree([])
setSuggestQuestions([])
cb?.()
}, [handleStop])
const updateCurrentQAOnTree = useCallback(({
@@ -682,6 +685,11 @@ export const useChat = (
})
}, [chatList, updateChatTreeNode])
useEffect(() => {
if (clearChatList)
handleRestart(() => clearChatListCallback?.(false))
}, [clearChatList, clearChatListCallback, handleRestart])
return {
chatList,
setTargetMessageId,

View File

@@ -72,6 +72,7 @@ export type ChatProps = {
noSpacing?: boolean
inputDisabled?: boolean
isMobile?: boolean
sidebarCollapseState?: boolean
}
const Chat: FC<ChatProps> = ({
@@ -110,6 +111,7 @@ const Chat: FC<ChatProps> = ({
noSpacing,
inputDisabled,
isMobile,
sidebarCollapseState,
}) => {
const { t } = useTranslation()
const { currentLogItem, setCurrentLogItem, showPromptLogModal, setShowPromptLogModal, showAgentLogModal, setShowAgentLogModal } = useAppStore(useShallow(state => ({
@@ -193,6 +195,11 @@ const Chat: FC<ChatProps> = ({
}
}, [])
useEffect(() => {
if (!sidebarCollapseState)
setTimeout(() => handleWindowResize(), 200)
}, [sidebarCollapseState])
const hasTryToAsk = config?.suggested_questions_after_answer?.enabled && !!suggestedQuestions?.length && onSend
return (
@@ -255,7 +262,7 @@ const Chat: FC<ChatProps> = ({
</div>
</div>
<div
className={`absolute bottom-0 bg-chat-input-mask ${(hasTryToAsk || !noChatInput || !noStopResponding) && chatFooterClassName}`}
className={`absolute bottom-0 bg-chat-input-mask flex justify-center ${(hasTryToAsk || !noChatInput || !noStopResponding) && chatFooterClassName}`}
ref={chatFooterRef}
>
<div