Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"react-hook-form": "^7.61.1",
"react-hotkeys-hook": "^5.1.0",
"react-intersection-observer": "^9.16.0",
"react-markdown": "^9.1.0",
"react-markdown": "10.1.0",
"react-textarea-autosize": "^8.5.9",
"react-use-draggable-scroll": "^0.4.7",
"react-wrap-balancer": "^1.1.1",
Expand Down
5 changes: 4 additions & 1 deletion apps/app/src/components/ai/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ import ReactMarkdown, { type Options } from 'react-markdown';
export const MemoizedReactMarkdown: FC<Options> = memo(
ReactMarkdown,
(prevProps, nextProps) =>
prevProps.children === nextProps.children && prevProps.className === nextProps.className,
prevProps.children === nextProps.children &&
prevProps.components === nextProps.components &&
prevProps.remarkPlugins === nextProps.remarkPlugins &&
prevProps.rehypePlugins === nextProps.rehypePlugins,
);
39 changes: 20 additions & 19 deletions apps/app/src/components/ai/message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,26 @@ const StreamableMarkdown = memo(({ text }: { text: string | StreamableValue<stri
const streamedText = useStreamableText(text);

return (
<MemoizedReactMarkdown
className="prose text-xs prose-p:my-1 prose-ul:my-1 prose-ol:my-1 prose-li:my-0"
components={{
p({ children }) {
return <p className="my-1 last:mb-0">{children}</p>;
},
ol({ children }) {
return <ol className="list-decimal list-inside space-y-0.5 my-1">{children}</ol>;
},
ul({ children }) {
return <ul className="list-disc list-inside space-y-0.5 my-1">{children}</ul>;
},
li({ children }) {
return <li className="leading-tight my-0">{children}</li>;
},
}}
>
{streamedText}
</MemoizedReactMarkdown>
<div className="prose text-xs prose-p:my-1 prose-ul:my-1 prose-ol:my-1 prose-li:my-0">
<MemoizedReactMarkdown
components={{
p({ children }) {
return <p className="my-1 last:mb-0">{children}</p>;
},
ol({ children }) {
return <ol className="list-decimal list-inside space-y-0.5 my-1">{children}</ol>;
},
ul({ children }) {
return <ul className="list-disc list-inside space-y-0.5 my-1">{children}</ul>;
},
li({ children }) {
return <li className="leading-tight my-0">{children}</li>;
},
}}
>
{streamedText}
</MemoizedReactMarkdown>
</div>
);
});

Expand Down
5 changes: 4 additions & 1 deletion apps/app/src/components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ import ReactMarkdown, { type Options } from 'react-markdown';
export const MemoizedReactMarkdown: FC<Options> = memo(
ReactMarkdown,
(prevProps, nextProps) =>
prevProps.children === nextProps.children && prevProps.className === nextProps.className,
prevProps.children === nextProps.children &&
prevProps.components === nextProps.components &&
prevProps.remarkPlugins === nextProps.remarkPlugins &&
prevProps.rehypePlugins === nextProps.rehypePlugins,
);
Loading
Loading