From cdb08be9517f1079117a5f97c05b02f95f160632 Mon Sep 17 00:00:00 2001 From: Yi Xiao <54782454+YIXIAO0@users.noreply.github.com> Date: Fri, 6 Sep 2024 19:20:18 +0800 Subject: [PATCH] fix: overflow issues in chat history (#8062) --- .../chat/chat-with-history/chat-wrapper.tsx | 4 +- .../base/chat/chat/citation/popup.tsx | 102 +++++++++--------- web/app/components/base/chat/chat/index.tsx | 4 +- .../chat/embedded-chatbot/chat-wrapper.tsx | 6 +- .../workflow/panel/chat-record/index.tsx | 4 +- .../panel/debug-and-preview/chat-wrapper.tsx | 4 +- .../panel/debug-and-preview/index.tsx | 1 - 7 files changed, 63 insertions(+), 62 deletions(-) diff --git a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx index 1129b18a8d..5a7bf1f17e 100644 --- a/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx +++ b/web/app/components/base/chat/chat-with-history/chat-wrapper.tsx @@ -144,9 +144,9 @@ const ChatWrapper = () => { config={appConfig} chatList={chatList} isResponding={isResponding} - chatContainerInnerClassName={`mx-auto pt-6 w-full max-w-[720px] ${isMobile && 'px-4'}`} + chatContainerInnerClassName={`mx-auto pt-6 w-full max-w-full ${isMobile && 'px-4'}`} chatFooterClassName='pb-4' - chatFooterInnerClassName={`mx-auto w-full max-w-[720px] ${isMobile && 'px-4'}`} + chatFooterInnerClassName={`mx-auto w-full max-w-full ${isMobile && 'px-4'}`} onSend={doSend} onStopResponding={handleStop} chatNode={chatNode} diff --git a/web/app/components/base/chat/chat/citation/popup.tsx b/web/app/components/base/chat/chat/citation/popup.tsx index d039d98e6b..b61bf623fe 100644 --- a/web/app/components/base/chat/chat/citation/popup.tsx +++ b/web/app/components/base/chat/chat/citation/popup.tsx @@ -53,72 +53,74 @@ const Popup: FC = ({ -
+
{data.documentName}
-
- { - data.sources.map((source, index) => ( - -
-
-
- -
- {source.segment_position || index + 1} +
+
+ { + data.sources.map((source, index) => ( + +
+
+
+ +
+ {source.segment_position || index + 1} +
+ { + showHitInfo && ( + + {t('common.chat.citation.linkToDataset')} + + + ) + }
+
{source.content}
{ showHitInfo && ( - - {t('common.chat.citation.linkToDataset')} - - +
+ } + /> + } + /> + } + /> + { + source.score && ( + + ) + } +
) }
-
{source.content}
{ - showHitInfo && ( -
- } - /> - } - /> - } - /> - { - source.score && ( - - ) - } -
+ index !== data.sources.length - 1 && ( +
) } -
- { - index !== data.sources.length - 1 && ( -
- ) - } - - )) - } + + )) + } +
diff --git a/web/app/components/base/chat/chat/index.tsx b/web/app/components/base/chat/chat/index.tsx index c5d9af45c2..b3eebb9583 100644 --- a/web/app/components/base/chat/chat/index.tsx +++ b/web/app/components/base/chat/chat/index.tsx @@ -192,12 +192,12 @@ const Chat: FC = ({
{chatNode}
{ chatList.map((item, index) => { diff --git a/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx b/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx index 4934339e87..e317b67edb 100644 --- a/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx +++ b/web/app/components/base/chat/embedded-chatbot/chat-wrapper.tsx @@ -99,7 +99,7 @@ const ChatWrapper = () => { return ( <> {!currentConversationId && ( -
+
{ config={appConfig} chatList={chatList} isResponding={isResponding} - chatContainerInnerClassName={cn('mx-auto w-full max-w-[720px] tablet:px-4', isMobile && 'px-4')} + chatContainerInnerClassName={cn('mx-auto w-full max-w-full tablet:px-4', isMobile && 'px-4')} chatFooterClassName='pb-4' - chatFooterInnerClassName={cn('mx-auto w-full max-w-[720px] tablet:px-4', isMobile && 'px-4')} + chatFooterInnerClassName={cn('mx-auto w-full max-w-full tablet:px-4', isMobile && 'px-4')} onSend={doSend} onStopResponding={handleStop} chatNode={chatNode} diff --git a/web/app/components/workflow/panel/chat-record/index.tsx b/web/app/components/workflow/panel/chat-record/index.tsx index 2ab3165c14..afd20b7358 100644 --- a/web/app/components/workflow/panel/chat-record/index.tsx +++ b/web/app/components/workflow/panel/chat-record/index.tsx @@ -103,9 +103,9 @@ const ChatRecord = () => { } as any} chatList={chatMessageList} chatContainerClassName='px-4' - chatContainerInnerClassName='pt-6' + chatContainerInnerClassName='pt-6 w-full max-w-full mx-auto' chatFooterClassName='px-4 rounded-b-2xl' - chatFooterInnerClassName='pb-4' + chatFooterInnerClassName='pb-4 w-full max-w-full mx-auto' chatNode={} noChatInput allToolIcons={{}} diff --git a/web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx b/web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx index 4655940037..e7639ddc79 100644 --- a/web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx +++ b/web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx @@ -103,9 +103,9 @@ const ChatWrapper = forwardRef(({ showConv chatList={chatList} isResponding={isResponding} chatContainerClassName='px-3' - chatContainerInnerClassName='pt-6' + chatContainerInnerClassName='pt-6 w-full max-w-full mx-auto' chatFooterClassName='px-4 rounded-bl-2xl' - chatFooterInnerClassName='pb-4' + chatFooterInnerClassName='pb-4 w-full max-w-full mx-auto' onSend={doSend} onStopResponding={handleStop} chatNode={( diff --git a/web/app/components/workflow/panel/debug-and-preview/index.tsx b/web/app/components/workflow/panel/debug-and-preview/index.tsx index 29fc48f896..8e1c489098 100644 --- a/web/app/components/workflow/panel/debug-and-preview/index.tsx +++ b/web/app/components/workflow/panel/debug-and-preview/index.tsx @@ -88,7 +88,6 @@ const DebugAndPreview = () => { - {expanded &&
}
)}