From 85b0b8373bf4758986729ba0465d3ceab78e5a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E7=BB=BF=E8=89=B2?= <48266410+lcedaw@users.noreply.github.com> Date: Wed, 27 Aug 2025 16:04:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20datasets=20hit-testing=20retrieve=20chu?= =?UTF-8?q?nking=20detail=20answer=20when=20docum=E2=80=A6=20(#24600)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: lijiezhao@perfect99.com --- .../components/chunk-detail-modal.tsx | 33 +++++++++++++++---- web/models/datasets.ts | 1 + 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/web/app/components/datasets/hit-testing/components/chunk-detail-modal.tsx b/web/app/components/datasets/hit-testing/components/chunk-detail-modal.tsx index 4fd62bb22d..71c5edb21a 100644 --- a/web/app/components/datasets/hit-testing/components/chunk-detail-modal.tsx +++ b/web/app/components/datasets/hit-testing/components/chunk-detail-modal.tsx @@ -27,10 +27,11 @@ const ChunkDetailModal: FC = ({ }) => { const { t } = useTranslation() const { segment, score, child_chunks } = payload - const { position, content, sign_content, keywords, document } = segment + const { position, content, sign_content, keywords, document, answer } = segment const isParentChildRetrieval = !!(child_chunks && child_chunks.length > 0) const extension = document.name.split('.').slice(-1)[0] as FileAppearanceTypeEnum const heighClassName = isParentChildRetrieval ? 'h-[min(627px,_80vh)] overflow-y-auto' : 'h-[min(539px,_80vh)] overflow-y-auto' + const labelPrefix = isParentChildRetrieval ? t('datasetDocuments.segment.parentChunk') : t('datasetDocuments.segment.chunk') return ( = ({
@@ -57,11 +58,29 @@ const ChunkDetailModal: FC = ({
- + {!answer && ( + + )} + {answer && ( +
+
+
Q
+
+ {content} +
+
+
+
A
+
+ {answer} +
+
+
+ )} {!isParentChildRetrieval && keywords && keywords.length > 0 && (
{t(`${i18nPrefix}.keyword`)}
diff --git a/web/models/datasets.ts b/web/models/datasets.ts index 12ea4972ca..bc00bf3f78 100644 --- a/web/models/datasets.ts +++ b/web/models/datasets.ts @@ -545,6 +545,7 @@ export type Segment = { keywords: string[] hit_count: number index_node_hash: string + answer: string } export type Document = {