mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-11 13:08:51 +01:00
🖋️ feat: Add option to render User Messages as Markdown (#4170)
This commit is contained in:
parent
42b7373ddc
commit
be44caaab1
10 changed files with 94 additions and 21 deletions
|
|
@ -0,0 +1,35 @@
|
|||
import { useRecoilState } from 'recoil';
|
||||
import { Switch } from '~/components/ui';
|
||||
import { useLocalize } from '~/hooks';
|
||||
import store from '~/store';
|
||||
|
||||
export default function UserMsgMarkdownSwitch({
|
||||
onCheckedChange,
|
||||
}: {
|
||||
onCheckedChange?: (value: boolean) => void;
|
||||
}) {
|
||||
const localize = useLocalize();
|
||||
const [enableUserMsgMarkdown, setEnableUserMsgMarkdown] = useRecoilState<boolean>(
|
||||
store.enableUserMsgMarkdown,
|
||||
);
|
||||
|
||||
const handleCheckedChange = (value: boolean) => {
|
||||
setEnableUserMsgMarkdown(value);
|
||||
if (onCheckedChange) {
|
||||
onCheckedChange(value);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between">
|
||||
<div> {localize('com_nav_user_msg_markdown')} </div>
|
||||
<Switch
|
||||
id="enableUserMsgMarkdown"
|
||||
checked={enableUserMsgMarkdown}
|
||||
onCheckedChange={handleCheckedChange}
|
||||
className="ml-4 mt-2 ring-ring-primary"
|
||||
data-testid="enableUserMsgMarkdown"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue