some fixes

This commit is contained in:
Siddharth Ganesan
2025-07-08 18:44:59 -07:00
parent 4fffc66ee0
commit ee66c15ed9
2 changed files with 27 additions and 0 deletions

View File

@@ -61,6 +61,19 @@ function ModalCopilotMessage({ message }: CopilotModalMessage) {
return match
})
// Also replace standalone ↗ symbols with clickable citation links
if (citations && citations.length > 0) {
let citationIndex = 0
processedText = processedText.replace(/↗/g, () => {
if (citationIndex < citations.length) {
const citation = citations[citationIndex]
citationIndex++
return `<a href="${citation.url}" target="_blank" rel="noopener noreferrer" class="inline-flex items-center text-primary hover:text-primary/80 text-sm" title="${citation.title}">↗</a>`
}
return '↗'
})
}
return processedText
}

View File

@@ -342,6 +342,20 @@ export const Copilot = forwardRef<CopilotRef, CopilotProps>(
return match
})
// Also replace standalone ↗ symbols with clickable citation links
// This handles cases where the LLM outputs ↗ directly
if (citations && citations.length > 0) {
let citationIndex = 0
processedContent = processedContent.replace(/↗/g, () => {
if (citationIndex < citations.length) {
const citation = citations[citationIndex]
citationIndex++
return `<a href="${citation.url}" target="_blank" rel="noopener noreferrer" class="inline-flex items-center text-primary hover:text-primary/80 transition-colors text-sm" title="${citation.title}">↗</a>`
}
return '↗'
})
}
// Basic markdown processing for better formatting
processedContent = processedContent
// Handle code blocks