Skip to content

Commit 438b418

Browse files
committed
fix: handle AISummary as string or object in dataset detail page
1 parent 0f3ea9b commit 438b418

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pages/UpdatedDatasetDetailPage.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,13 @@ const UpdatedDatasetDetailPage: React.FC = () => {
276276
const [isPreviewLoading, setIsPreviewLoading] = useState(false);
277277
const [copiedKey, setCopiedKey] = useState<string | null>(null);
278278
const copyTimer = useRef<number | null>(null);
279-
const aiSummary = datasetDocument?.[".datainfo"]?.AISummary ?? "";
279+
// const aiSummary = datasetDocument?.[".datainfo"]?.AISummary ?? "";
280+
const rawSummary = datasetDocument?.[".datainfo"]?.AISummary;
281+
const aiSummary: string = !rawSummary
282+
? ""
283+
: typeof rawSummary === "string"
284+
? rawSummary
285+
: Object.values(rawSummary).filter(Boolean).join("\n\n");
280286
const readme = datasetDocument?.["README"] ?? "";
281287
const handleSelectRevision = (newRev?: string | null) => {
282288
setSearchParams((prev) => {

0 commit comments

Comments
 (0)