From 972cf3cd01cf282fa8d29c54815c5769b64197df Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 27 Dec 2023 17:59:50 +0800 Subject: [PATCH 1/3] fix: splitting text ui broken (#1848) --- .../datasets/create/step-two/index.module.css | 12 +++++++++++- .../components/datasets/create/step-two/index.tsx | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/web/app/components/datasets/create/step-two/index.module.css b/web/app/components/datasets/create/step-two/index.module.css index 622ca1e73abed8..7ad0bbc81ffcb5 100644 --- a/web/app/components/datasets/create/step-two/index.module.css +++ b/web/app/components/datasets/create/step-two/index.module.css @@ -262,6 +262,7 @@ font-size: 13px; line-height: 18px; } + .input { @apply inline-flex h-9 w-full py-1 px-2 rounded-lg text-xs leading-normal; @apply bg-gray-100 caret-primary-600 hover:bg-gray-100 focus:ring-1 focus:ring-inset focus:ring-gray-200 focus-visible:outline-none focus:bg-white placeholder:text-gray-400; @@ -316,9 +317,11 @@ .fileIcon.json { background-image: url(../assets/json.svg); } + .sourceContent { flex: 1 1 auto; } + .sourceCount { @apply shrink-0 ml-1; font-weight: 500; @@ -326,6 +329,7 @@ line-height: 18px; color: #667085; } + .segmentCount { flex: 1 1 30%; max-width: 120px; @@ -382,6 +386,10 @@ .previewWrap { flex-shrink: 0; + width: 524px; +} + +.previewWrap.isMobile { max-width: 524px; } @@ -410,15 +418,17 @@ backdrop-filter: blur(4px); animation: fix 0.5s; } + @keyframes fix { from { padding-top: 42px; font-size: 18px; line-height: 28px; } + to { padding-top: 12px; font-size: 12px; line-height: 18px; } -} +} \ No newline at end of file diff --git a/web/app/components/datasets/create/step-two/index.tsx b/web/app/components/datasets/create/step-two/index.tsx index f9692bc8fae898..69e83c232bff61 100644 --- a/web/app/components/datasets/create/step-two/index.tsx +++ b/web/app/components/datasets/create/step-two/index.tsx @@ -820,7 +820,7 @@ const StepTwo = ({ - {showPreview &&
+ {showPreview &&
From 643845cf144cf4e949d43b80536746c7eca32660 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 26 Dec 2023 17:07:01 +0800 Subject: [PATCH 2/3] temp --- web/app/components/app/chat/type.ts | 9 ++++++++ .../app/configuration/debug/index.tsx | 21 +++++++++++++++++++ .../components/share/chat/sidebar/index.tsx | 2 +- .../share/chatbot/sidebar/index.tsx | 2 +- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/web/app/components/app/chat/type.ts b/web/app/components/app/chat/type.ts index 972b9424a8d5f0..d8385287a92521 100644 --- a/web/app/components/app/chat/type.ts +++ b/web/app/components/app/chat/type.ts @@ -73,6 +73,15 @@ export type IChatItem = { export type MessageEnd = { id: string retriever_resources?: CitationItem[] + metadata: { + annotation_reply: { + id: string + account: { + id: string + name: string + } + } + } } export type MessageReplace = { diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx index 14b20de64171d1..fcfce3ec70f006 100644 --- a/web/app/components/app/configuration/debug/index.tsx +++ b/web/app/components/app/configuration/debug/index.tsx @@ -347,6 +347,26 @@ const Debug: FC = ({ } }, onMessageEnd: (messageEnd) => { + // TODO + if (messageEnd.metadata?.annotation_reply) { + responseItem.id = messageEnd.id + responseItem.annotation = ({ + id: messageEnd.metadata.annotation_reply.id, + authorName: messageEnd.metadata.annotation_reply.account.name, + } as AnnotationType) + const newListWithAnswer = produce( + getChatList().filter(item => item.id !== responseItem.id && item.id !== placeholderAnswerId), + (draft) => { + if (!draft.find(item => item.id === questionId)) + draft.push({ ...questionItem }) + + draft.push({ + ...responseItem, + }) + }) + setChatList(newListWithAnswer) + return + } responseItem.citation = messageEnd.retriever_resources const newListWithAnswer = produce( @@ -363,6 +383,7 @@ const Debug: FC = ({ responseItem.content = messageReplace.answer }, onAnnotationReply: (annotationReply) => { + // TODO: temp debug responseItem.id = annotationReply.id responseItem.content = annotationReply.answer responseItem.annotation = ({ diff --git a/web/app/components/share/chat/sidebar/index.tsx b/web/app/components/share/chat/sidebar/index.tsx index 51b564ace1b340..8d3fffdfc65ff3 100644 --- a/web/app/components/share/chat/sidebar/index.tsx +++ b/web/app/components/share/chat/sidebar/index.tsx @@ -107,7 +107,7 @@ const Sidebar: FC = ({
diff --git a/web/app/components/share/chatbot/sidebar/index.tsx b/web/app/components/share/chatbot/sidebar/index.tsx index cfb8e86fbfe583..a38e2f9c745c54 100644 --- a/web/app/components/share/chatbot/sidebar/index.tsx +++ b/web/app/components/share/chatbot/sidebar/index.tsx @@ -92,7 +92,7 @@ const Sidebar: FC = ({
From b78d12e449b8b4e2a6ae99fac08c389227449cae Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 28 Dec 2023 14:23:57 +0800 Subject: [PATCH 3/3] chore: retriever_resources to new struct --- web/app/components/app/chat/type.ts | 2 +- web/app/components/app/configuration/debug/index.tsx | 2 +- web/app/components/explore/universal-chat/index.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/app/components/app/chat/type.ts b/web/app/components/app/chat/type.ts index d8385287a92521..fe34aced3f3e76 100644 --- a/web/app/components/app/chat/type.ts +++ b/web/app/components/app/chat/type.ts @@ -72,8 +72,8 @@ export type IChatItem = { export type MessageEnd = { id: string - retriever_resources?: CitationItem[] metadata: { + retriever_resources?: CitationItem[] annotation_reply: { id: string account: { diff --git a/web/app/components/app/configuration/debug/index.tsx b/web/app/components/app/configuration/debug/index.tsx index fcfce3ec70f006..e2a3455caa76d2 100644 --- a/web/app/components/app/configuration/debug/index.tsx +++ b/web/app/components/app/configuration/debug/index.tsx @@ -367,7 +367,7 @@ const Debug: FC = ({ setChatList(newListWithAnswer) return } - responseItem.citation = messageEnd.retriever_resources + responseItem.citation = messageEnd.metadata?.retriever_resources || [] const newListWithAnswer = produce( getChatList().filter(item => item.id !== responseItem.id && item.id !== placeholderAnswerId), diff --git a/web/app/components/explore/universal-chat/index.tsx b/web/app/components/explore/universal-chat/index.tsx index acef77b938df0e..8e3044c3a694ed 100644 --- a/web/app/components/explore/universal-chat/index.tsx +++ b/web/app/components/explore/universal-chat/index.tsx @@ -608,7 +608,7 @@ const Main: FC = () => { setChatList(newListWithAnswer) }, onMessageEnd: (messageEnd) => { - responseItem.citation = messageEnd.retriever_resources + responseItem.citation = messageEnd.metadata?.retriever_resources const newListWithAnswer = produce( getChatList().filter(item => item.id !== responseItem.id && item.id !== placeholderAnswerId),