-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathdialogContentComponent.tsx
More file actions
74 lines (67 loc) · 2.66 KB
/
dialogContentComponent.tsx
File metadata and controls
74 lines (67 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { Document } from "../../api/apiTypes/embedded";
import { DialogContent, Tag } from "@fluentui/react-components";
import { Text } from "@fluentui/react-components";
import { useTranslation } from "react-i18next";
interface IDialogContentComponentProps {
className?: string;
metadata: Document | null;
allChunkTexts: string[];
isExpanded: boolean;
setIsExpanded: (isExpanded: boolean) => void;
}
export function DialogContentComponent({
className,
metadata,
allChunkTexts,
isExpanded,
setIsExpanded,
}: IDialogContentComponentProps) {
const { t } = useTranslation();
return (
<DialogContent className={`${className} `}>
{metadata?.summary && metadata.summary.length > 0 && (
<div className="mb-4">
<Text size={500} weight="semibold">
{t("components.dialog-content.extractive-summary")}
</Text>
</div>
)}
{metadata?.summary.split('\n').map((item, index) => (
<div key={index} className="mb-4">
<Text size={300} weight="regular">
{item}
</Text>
</div>
))}
{metadata?.summary && (
<div className="mb-4 ">
<Tag className="shadow-md" size="extra-small">{t("components.dialog-content.ai-generated-tag")}</Tag>
</div>
)}
{allChunkTexts && allChunkTexts.length > 0 && allChunkTexts.some((item) => item !== null) && (
<div className="mb-4 flex justify-between">
<Text size={500} weight="semibold">
{t("components.dialog-content.chunk-texts")}
</Text>
</div>
)}
<div className="mb-4 h-96 overflow-y-auto autoHeight">
{allChunkTexts.map(
(item, index) =>
item && (
<div key={index} className="mb-4">
<div
className="rounded-md border border-neutral-500 p-3"
onClick={() => setIsExpanded(!isExpanded)}
>
<Text size={300} weight="regular">
{isExpanded ? item : `${item.substring(0, 200)}...`}
</Text>
</div>
</div>
)
)}
</div>
</DialogContent>
);
}