From 817fdc1f362998d5ec0e248597bab5bf8be4b8a7 Mon Sep 17 00:00:00 2001 From: pablonyx Date: Wed, 18 Dec 2024 20:44:24 -0800 Subject: [PATCH] Ensure metadata overrides file contents (#3512) * ensure metadata overrides file contents * update more blocks --- .../documentSidebar/ChatDocumentDisplay.tsx | 12 ++-------- .../chat_search/sources/SourceCard.tsx | 12 ++-------- web/src/components/search/DocumentDisplay.tsx | 11 ++++------ .../components/search/results/Citation.tsx | 15 ++++--------- web/src/lib/search/utils.ts | 22 +++++++++++++++++-- 5 files changed, 32 insertions(+), 40 deletions(-) diff --git a/web/src/app/chat/documentSidebar/ChatDocumentDisplay.tsx b/web/src/app/chat/documentSidebar/ChatDocumentDisplay.tsx index dccb0962e80..6069bd6f425 100644 --- a/web/src/app/chat/documentSidebar/ChatDocumentDisplay.tsx +++ b/web/src/app/chat/documentSidebar/ChatDocumentDisplay.tsx @@ -7,7 +7,7 @@ import { DocumentUpdatedAtBadge } from "@/components/search/DocumentUpdatedAtBad import { MetadataBadge } from "@/components/MetadataBadge"; import { WebResultIcon } from "@/components/WebResultIcon"; import { Dispatch, SetStateAction } from "react"; -import { ValidSources } from "@/lib/types"; +import { openDocument } from "@/lib/search/utils"; interface DocumentDisplayProps { closeSidebar: () => void; @@ -73,14 +73,6 @@ export function ChatDocumentDisplay({ return null; } - const handleViewFile = async () => { - if (document.source_type == ValidSources.File && setPresentingDocument) { - setPresentingDocument(document); - } else if (document.link) { - window.open(document.link, "_blank"); - } - }; - const hasMetadata = document.updated_at || Object.keys(document.metadata).length > 0; return ( @@ -91,7 +83,7 @@ export function ChatDocumentDisplay({ }`} >