diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/copilot-message/components/markdown-renderer.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/copilot-message/components/markdown-renderer.tsx index 7a85d108b6..bc64ca9293 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/copilot-message/components/markdown-renderer.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/copilot-message/components/markdown-renderer.tsx @@ -4,7 +4,7 @@ import React, { useEffect, useMemo, useState } from 'react' import { Check, Copy } from 'lucide-react' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' -import { Tooltip } from '@/components/emcn' +import { Code, Tooltip } from '@/components/emcn' /** * Recursively extracts text content from React elements @@ -28,56 +28,30 @@ const getTextContent = (element: React.ReactNode): string => { return '' } -// Fix for code block text rendering issues +// Global layout fixes for markdown content inside the copilot panel if (typeof document !== 'undefined') { const styleId = 'copilot-markdown-fix' if (!document.getElementById(styleId)) { const style = document.createElement('style') style.id = styleId style.textContent = ` - .copilot-markdown-wrapper pre { - color: #F5F5F5 !important; - font-weight: 400 !important; - text-shadow: none !important; - filter: none !important; - opacity: 1 !important; - -webkit-font-smoothing: antialiased !important; - -moz-osx-font-smoothing: grayscale !important; - text-rendering: optimizeLegibility !important; - max-width: 100% !important; - overflow: auto !important; - } - - .dark .copilot-markdown-wrapper pre { - color: #F0F0F0 !important; - } - - .copilot-markdown-wrapper pre code, - .copilot-markdown-wrapper pre code *, - .copilot-markdown-wrapper pre span, - .copilot-markdown-wrapper pre div { - color: inherit !important; - opacity: 1 !important; - font-weight: 400 !important; - text-shadow: none !important; - filter: none !important; - -webkit-font-smoothing: antialiased !important; - -moz-osx-font-smoothing: grayscale !important; - text-rendering: optimizeLegibility !important; - } - /* Prevent any markdown content from expanding beyond the panel */ - .copilot-markdown-wrapper, .copilot-markdown-wrapper * { + .copilot-markdown-wrapper, + .copilot-markdown-wrapper * { max-width: 100% !important; } - .copilot-markdown-wrapper p, .copilot-markdown-wrapper li { + + .copilot-markdown-wrapper p, + .copilot-markdown-wrapper li { overflow-wrap: anywhere !important; word-break: break-word !important; } + .copilot-markdown-wrapper a { overflow-wrap: anywhere !important; word-break: break-all !important; } + .copilot-markdown-wrapper code:not(pre code) { white-space: normal !important; overflow-wrap: anywhere !important; @@ -219,7 +193,7 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend ), - // Code blocks + // Code blocks - render using shared Code.Viewer for consistent styling pre: ({ children }: React.HTMLAttributes) => { let codeContent: React.ReactNode = children let language = 'code' @@ -272,13 +246,24 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend } } + // Map markdown language tag to Code.Viewer supported languages + const normalizedLanguage = (language || '').toLowerCase() + const viewerLanguage: 'javascript' | 'json' | 'python' = + normalizedLanguage === 'json' + ? 'json' + : normalizedLanguage === 'python' || normalizedLanguage === 'py' + ? 'python' + : 'javascript' + return ( -
-
- {language} +
+
+ + {language === 'code' ? viewerLanguage : language} +
-
-
-                {actualCodeText}
-              
-
+
) }, @@ -307,7 +293,7 @@ export default function CopilotMarkdownRenderer({ content }: CopilotMarkdownRend if (inline) { return ( {children} diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/inline-tool-call/inline-tool-call.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/inline-tool-call/inline-tool-call.tsx index be5675f3a7..ee68e5f29b 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/inline-tool-call/inline-tool-call.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel-new/components/copilot/components/inline-tool-call/inline-tool-call.tsx @@ -463,30 +463,40 @@ export function InlineToolCall({ const url = params.url || '' const method = (params.method || '').toUpperCase() return ( -
-
-
- Method -
-
- Endpoint -
-
-
-
- - {method || 'GET'} - -
-
- - {url || 'URL not provided'} - -
-
+
+ + + + + + + + + + + + + +
+ Method + + Endpoint +
+
+ + {method || 'GET'} + +
+
+
+ + {url || 'URL not provided'} + +
+
) } @@ -499,7 +509,7 @@ export function InlineToolCall({ const normalizedEntries: Array<[string, string]> = [] Object.entries(variables).forEach(([key, value]) => { if (typeof value === 'object' && value !== null && 'name' in value && 'value' in value) { - // Handle {name: "key", value: "val"} format + // Handle { name: "KEY", value: "VAL" } format normalizedEntries.push([String((value as any).name), String((value as any).value)]) } else { // Handle direct key-value format @@ -508,35 +518,48 @@ export function InlineToolCall({ }) return ( -
-
-
- Name -
-
- Value -
-
- {normalizedEntries.length === 0 ? ( -
- No variables provided -
- ) : ( -
- {normalizedEntries.map(([name, value]) => ( -
-
- {name} -
-
- - {value} - -
-
- ))} -
- )} +
+ + + + + + + + + {normalizedEntries.length === 0 ? ( + + + + ) : ( + normalizedEntries.map(([name, value]) => ( + + + + + )) + )} + +
+ Name + + Value +
+ No variables provided +
+
+ {name} +
+
+
+ + {value} + +
+
) }