RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix(citation): open external web documents directly (#20452)
chanxa2709a4f5ddd
diff --git a/web/src/components/floating-chat-widget-markdown.tsx b/web/src/components/floating-chat-widget-markdown.tsxindex 585c59d951..c89c954ee1 100644--- a/web/src/components/floating-chat-widget-markdown.tsx+++ b/web/src/components/floating-chat-widget-markdown.tsx@@ -114,6 +114,12 @@ const FloatingChatWidgetMarkdown = ({return;}if (!documentUrl) return;+ // Web page documents carry their own url; opening the internal+ // /document route for them lands on an empty page.+ if (/^https?:\/\//i.test(documentUrl)) {+ window.open(documentUrl, '_blank', 'noopener,noreferrer');+ return;+ }window.open(`/document/${documentId}?ext=${fileExtension}&resource=${'document'}`,'_blank',diff --git a/web/src/components/markdown-content/index.tsx b/web/src/components/markdown-content/index.tsxindex 507fa31040..c94de3de23 100644--- a/web/src/components/markdown-content/index.tsx+++ b/web/src/components/markdown-content/index.tsx@@ -200,6 +200,12 @@ const MarkdownContent = ({return;}if (!documentUrl) return;+ // Web page documents carry their own url; opening the internal+ // /document route for them lands on an empty page.+ if (/^https?:\/\//i.test(documentUrl)) {+ window.open(documentUrl, '_blank', 'noopener,noreferrer');+ return;+ }window.open(`/document/${documentId}?ext=${fileExtension}&resource=${'document'}`,'_blank',diff --git a/web/src/components/next-markdown-content/index.tsx b/web/src/components/next-markdown-content/index.tsxindex ffa818961d..0baf4ea648 100644--- a/web/src/components/next-markdown-content/index.tsx+++ b/web/src/components/next-markdown-content/index.tsx@@ -244,6 +244,12 @@ function MarkdownContent({return;}if (!documentUrl) return;+ // Web page documents carry their own url; opening the internal+ // /document route for them lands on an empty page.+ if (/^https?:\/\//i.test(documentUrl)) {+ window.open(documentUrl, '_blank', 'noopener,noreferrer');+ return;+ }window.open(`/document/${documentId}?ext=${fileExtension}&resource=${'document'}`,'_blank',diff --git a/web/src/pages/next-search/markdown-content/index.tsx b/web/src/pages/next-search/markdown-content/index.tsxindex 4266b00955..ac260a1253 100644--- a/web/src/pages/next-search/markdown-content/index.tsx+++ b/web/src/pages/next-search/markdown-content/index.tsx@@ -113,15 +113,14 @@ const MarkdownContent = ({}, [reference, setDocumentIds]);const handleDocumentButtonClick = useCallback(- (- documentId: string,- chunk: IReferenceChunk,- isPdf: boolean = false,- documentUrl?: string,- ) => {- void isPdf;- void documentUrl;+ (documentId: string, chunk: IReferenceChunk, documentUrl?: string) => {return () => {+ // Web page documents carry their own url; the preview modal can't+ // render them, so open the link directly.+ if (documentUrl && /^https?:\/\//i.test(documentUrl)) {+ window.open(documentUrl, '_blank', 'noopener,noreferrer');+ return;+ }clickDocumentButton?.(documentId, chunk);};},@@ -174,6 +173,7 @@ const MarkdownContent = ({const getPopoverContent = useCallback((chunkIndex: number) => {const {+ documentUrl,fileThumbnail,fileExtension,imageId,@@ -232,8 +232,7 @@ const MarkdownContent = ({onClick={handleDocumentButtonClick(documentId,chunkItem,- // fileExtension === 'pdf',- // documentUrl,+ documentUrl,)}>{document?.doc_name}