diff --git a/frontend/src/components/ResponsePanel.tsx b/frontend/src/components/ResponsePanel.tsx index b93c6ba..067b599 100644 --- a/frontend/src/components/ResponsePanel.tsx +++ b/frontend/src/components/ResponsePanel.tsx @@ -3,7 +3,7 @@ import { MessageSquare, AlertCircle, Copy, ChevronDown, ChevronRight } from 'luc import ReactMarkdown from 'react-markdown' import type { SourceMetadata, SubQuestionSources } from '../types' import { getPdfViewerUrl } from '../lib/api' -import { processCitations, processCitationsForSubq, extractCitedSources } from '../utils/citationParser' +import { processCitations, processCitationsForSubq, extractCitedSources, highlightTerms } from '../utils/citationParser' import { bulletizeMarkdown } from '../utils/citationParser' function getHighlightUrl(document_id: string, chunk_index: number, sub_question: string): string { @@ -32,6 +32,10 @@ const CitationLink = ({ href, children }: { href?: string; children?: React.Reac ) +const HighlightMark = ({ children }: { children?: React.ReactNode }) => ( + {children} +) + function parseAnswerSections(answer: string): string[] { const sections = answer.split(/## Sub-question \d+:[^\n]*\n/) if (sections.length <= 1) return [bulletizeMarkdown(answer)] @@ -107,6 +111,7 @@ function SubQuestionSection({ sq.sources.map(s => ({ ...s, sub_question_text: sq.sub_question_text })) ) const processedAnswer = processCitations(answerSection, allSources, highlightReadyKeys) + const highlightedAnswer = highlightTerms(processedAnswer) return (