Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
refactor(Markdown.tsx): add isEdited as a condition whether or not to render html as well as perform expensive validation
Daniel Avila7fa01da30ef9
diff --git a/client/src/components/Messages/Content/Markdown.tsx b/client/src/components/Messages/Content/Markdown.tsxindex 367e52f1a9..11061a906a 100644--- a/client/src/components/Messages/Content/Markdown.tsx+++ b/client/src/components/Messages/Content/Markdown.tsx@@ -45,9 +45,10 @@ const Markdown = React.memo(({ content, message, showCursor }: TContentProps) =>const isSubmitting = useRecoilValue(store.isSubmitting);const latestMessage = useRecoilValue(store.latestMessage);const isInitializing = content === '<span className="result-streaming">█</span>';- const isLatestMessage = message?.messageId === latestMessage?.messageId;++ const { isEdited, messageId } = message ?? {};+ const isLatestMessage = messageId === latestMessage?.messageId;const currentContent = content?.replace('z-index: 1;', '') ?? '';- const isValidIFrame = validateIframe(currentContent);useEffect(() => {let timer1: NodeJS.Timeout, timer2: NodeJS.Timeout;@@ -88,7 +89,12 @@ const Markdown = React.memo(({ content, message, showCursor }: TContentProps) =>[rehypeRaw],];- if ((!isInitializing || !isLatestMessage) && !isValidIFrame) {+ let isValidIframe: string | boolean | null = false;+ if (!isEdited) {+ isValidIframe = validateIframe(currentContent);+ }++ if (isEdited || ((!isInitializing || !isLatestMessage) && !isValidIframe)) {rehypePlugins.pop();}