Skip to content

Commit c0b8e1a

Browse files
committed
Modal fixes
1 parent 82cb609 commit c0b8e1a

File tree

1 file changed

+6
-37
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-modal

1 file changed

+6
-37
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-modal/copilot-modal.tsx

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -41,45 +41,14 @@ interface CopilotModalMessage {
4141

4242
// Modal-specific message component
4343
function ModalCopilotMessage({ message }: CopilotModalMessage) {
44-
const renderCitations = (
45-
text: string,
46-
citations?: Array<{ id: number; title: string; url: string }>
47-
) => {
48-
if (!citations || citations.length === 0) return text
49-
44+
const renderMarkdown = (text: string) => {
5045
let processedText = text
5146

52-
// Replace [1], [2], [3] etc. with clickable citation icons
53-
processedText = processedText.replace(/\[(\d+)\]/g, (match, num) => {
54-
const citationIndex = Number.parseInt(num) - 1
55-
const citation = citations?.[citationIndex]
56-
57-
if (citation) {
58-
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>`
59-
}
60-
61-
return match
62-
})
63-
64-
// Also replace standalone ↗ symbols with clickable citation links
65-
if (citations && citations.length > 0) {
66-
let citationIndex = 0
67-
processedText = processedText.replace(//g, () => {
68-
if (citationIndex < citations.length) {
69-
const citation = citations[citationIndex]
70-
citationIndex++
71-
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>`
72-
}
73-
return '↗'
74-
})
75-
}
76-
77-
return processedText
78-
}
79-
80-
const renderMarkdown = (text: string) => {
81-
// Handle citations first
82-
let processedText = renderCitations(text, message.citations)
47+
// Process markdown links: [text](url)
48+
processedText = processedText.replace(
49+
/\[([^\]]+)\]\(([^)]+)\)/g,
50+
'<a href="$2" target="_blank" rel="noopener noreferrer" class="text-blue-600 hover:text-blue-800 font-semibold underline transition-colors">$1</a>'
51+
)
8352

8453
// Handle code blocks
8554
processedText = processedText.replace(

0 commit comments

Comments
 (0)