From ee66c15ed99a9e387d7e812c906f5a7c6217f672 Mon Sep 17 00:00:00 2001 From: Siddharth Ganesan Date: Tue, 8 Jul 2025 18:44:59 -0700 Subject: [PATCH] some fixes --- .../components/copilot-modal/copilot-modal.tsx | 13 +++++++++++++ .../panel/components/copilot/copilot.tsx | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-modal/copilot-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-modal/copilot-modal.tsx index 69c4a547bd..4c04c4c469 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-modal/copilot-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-modal/copilot-modal.tsx @@ -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 `↗` + } + return '↗' + }) + } + return processedText } diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx index 0a88eb4d53..1676d25559 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx @@ -342,6 +342,20 @@ export const Copilot = forwardRef( 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 `↗` + } + return '↗' + }) + } + // Basic markdown processing for better formatting processedContent = processedContent // Handle code blocks