mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-01 01:12:43 -05:00
fix: highlight the cited text when opening a file from the source list (#35167)
Opening a file from the source list under an answer showed it with nothing highlighted, and a PDF opened at its first page instead of the cited one. This happened for any source with more than one paragraph. The source list now highlights the retrieved text and opens at the cited page again, as it did before paragraph citations. A plain citation chip in the answer still opens the whole source, as before. Fixes #35165
This commit is contained in:
1 parent
affd38a1d3
commit
8b48fe94cd
1 file changed
+3
-1
@@ -64,7 +64,9 @@
|
||||
// except for plain [1] on a source with numbered paragraphs: that cites it as a whole.
|
||||
const claimed = claim ? getClaimSpans(claim, fileSpans) : [];
|
||||
const wholeSource =
|
||||
!cited.length && (citation.paragraphs ?? []).some((paragraphs: any[]) => paragraphs?.length);
|
||||
typeof sourceId === 'string' &&
|
||||
!cited.length &&
|
||||
(citation.paragraphs ?? []).some((paragraphs: any[]) => paragraphs?.length);
|
||||
const marked = claimed.length ? claimed : wholeSource ? [] : fileSpans;
|
||||
const metadata = (marked[0] ?? spans[0])?.metadata ?? citation.metadata?.[0];
|
||||
const fileName = String(metadata?.name ?? citation.source?.name ?? '');
|
||||
|
||||
Reference in new issue
Block a user