-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: external dataset hit test display issue(#12564)
- Loading branch information
zhuxinliang
committed
Jan 10, 2025
1 parent
989fb11
commit 6733cf7
Showing
3 changed files
with
87 additions
and
17 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
web/app/components/datasets/hit-testing/components/result-item-external.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
"use client"; | ||
import type { FC } from "react" | ||
import React from "react" | ||
import { useBoolean } from "ahooks" | ||
import SegmentCard from "@/app/components/datasets/documents/detail/completed/SegmentCard" | ||
import type { ExternalKnowledgeBaseHitTesting } from "@/models/datasets" | ||
import cn from "@/utils/classnames" | ||
import Modal from "@/app/components/base/modal" | ||
import s from "@/app/components/datasets/documents/detail/completed/style.module.css" | ||
|
||
type Props = { | ||
payload: ExternalKnowledgeBaseHitTesting; | ||
}; | ||
|
||
const ResultItemExternal: FC<Props> = ({ payload }) => { | ||
const record = payload; | ||
const [ | ||
isShowDetailModal, | ||
{ setTrue: showDetailModal, setFalse: hideDetailModal }, | ||
] = useBoolean(false); | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
"pt-3 bg-chat-bubble-bg rounded-xl hover:shadow-lg cursor-pointer" | ||
)} | ||
onClick={showDetailModal} | ||
> | ||
<SegmentCard | ||
loading={false} | ||
refSource={{ | ||
title: record.title, | ||
uri: record.metadata | ||
? record.metadata["x-amz-bedrock-kb-source-uri"] | ||
: "", | ||
}} | ||
isExternal | ||
contentExternal={record.content} | ||
score={record.score} | ||
scene="hitTesting" | ||
className="h-[216px] mb-4" | ||
/> | ||
|
||
{isShowDetailModal && ( | ||
<Modal | ||
className={"py-10 px-8"} | ||
closable | ||
onClose={hideDetailModal} | ||
isShow={isShowDetailModal} | ||
> | ||
<div className="w-full overflow-x-auto px-2"> | ||
<div className={s.segModalContent}> | ||
<div className="mb-4 text-md text-gray-800 h-full"> | ||
{record.content} | ||
</div> | ||
</div> | ||
</div> | ||
</Modal> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
|
||
export default React.memo(ResultItemExternal); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters