mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-16 07:25:31 +01:00
* WIP: basic route for file downloads and file strategy for generating readablestream to pipe as res * chore(DALLE3): add typing for OpenAI client * chore: add `CONSOLE_JSON` notes to dotenv.md * WIP: first pass OpenAI Assistants File Output handling * feat: first pass assistants output file download from openai * chore: yml vs. yaml variation to .gitignore for `librechat.yml` * refactor(retrieveAndProcessFile): remove redundancies * fix(syncMessages): explicit sort of apiMessages to fix message order on abort * chore: add logs for warnings and errors, show toast on frontend * chore: add logger where console was still being used
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { memo } from 'react';
|
|
import remarkGfm from 'remark-gfm';
|
|
import remarkMath from 'remark-math';
|
|
import rehypeKatex from 'rehype-katex';
|
|
import supersub from 'remark-supersub';
|
|
import ReactMarkdown from 'react-markdown';
|
|
import rehypeHighlight from 'rehype-highlight';
|
|
import type { PluggableList } from 'unified';
|
|
import { langSubset } from '~/utils';
|
|
import { code, a, p } from './Markdown';
|
|
|
|
const MarkdownLite = memo(({ content = '' }: { content?: string }) => {
|
|
const rehypePlugins: PluggableList = [
|
|
[rehypeKatex, { output: 'mathml' }],
|
|
[
|
|
rehypeHighlight,
|
|
{
|
|
detect: true,
|
|
ignoreMissing: true,
|
|
subset: langSubset,
|
|
},
|
|
],
|
|
];
|
|
|
|
return (
|
|
<ReactMarkdown
|
|
remarkPlugins={[supersub, remarkGfm, [remarkMath, { singleDollarTextMath: true }]]}
|
|
rehypePlugins={rehypePlugins}
|
|
linkTarget="_new"
|
|
components={
|
|
{
|
|
code,
|
|
a,
|
|
p,
|
|
} as {
|
|
[nodeType: string]: React.ElementType;
|
|
}
|
|
}
|
|
>
|
|
{content}
|
|
</ReactMarkdown>
|
|
);
|
|
});
|
|
|
|
export default MarkdownLite;
|