forked from danny-avila/LibreChat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✏️ feat: LaTeX parsing for Messages (danny-avila#1585)
* feat: Beta features tab in Settings and LaTeX Parsing toggle * feat: LaTex parsing with spec
- Loading branch information
1 parent
264c171
commit 3aed0e9
Showing
17 changed files
with
290 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { memo } from 'react'; | ||
import * as Tabs from '@radix-ui/react-tabs'; | ||
import { SettingsTabValues } from 'librechat-data-provider'; | ||
import LaTeXParsing from './LaTeXParsing'; | ||
import ModularChat from './ModularChat'; | ||
|
||
function Beta() { | ||
return ( | ||
<Tabs.Content | ||
value={SettingsTabValues.BETA} | ||
role="tabpanel" | ||
className="w-full md:min-h-[300px]" | ||
> | ||
<div className="flex flex-col gap-3 text-sm text-gray-600 dark:text-gray-300"> | ||
<div className="border-b pb-3 last-of-type:border-b-0 dark:border-gray-700"> | ||
<ModularChat /> | ||
</div> | ||
<div className="border-b pb-3 last-of-type:border-b-0 dark:border-gray-700"> | ||
<LaTeXParsing /> | ||
</div> | ||
</div> | ||
</Tabs.Content> | ||
); | ||
} | ||
|
||
export default memo(Beta); |
33 changes: 33 additions & 0 deletions
33
client/src/components/Nav/SettingsTabs/Beta/LaTeXParsing.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { useRecoilState } from 'recoil'; | ||
import { Switch } from '~/components/ui'; | ||
import { useLocalize } from '~/hooks'; | ||
import store from '~/store'; | ||
|
||
export default function LaTeXParsingSwitch({ | ||
onCheckedChange, | ||
}: { | ||
onCheckedChange?: (value: boolean) => void; | ||
}) { | ||
const [LaTeXParsing, setLaTeXParsing] = useRecoilState<boolean>(store.LaTeXParsing); | ||
const localize = useLocalize(); | ||
|
||
const handleCheckedChange = (value: boolean) => { | ||
setLaTeXParsing(value); | ||
if (onCheckedChange) { | ||
onCheckedChange(value); | ||
} | ||
}; | ||
|
||
return ( | ||
<div className="flex items-center justify-between"> | ||
<div>{localize('com_nav_latex_parsing')} </div> | ||
<Switch | ||
id="LaTeXParsing" | ||
checked={LaTeXParsing} | ||
onCheckedChange={handleCheckedChange} | ||
className="ml-4 mt-2" | ||
data-testid="LaTeXParsing" | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export { default as General } from './General/General'; | ||
export { ClearChatsButton } from './General/General'; | ||
export { default as Data } from './Data/Data'; | ||
export { default as Beta } from './Beta/Beta'; | ||
export { RevokeKeysButton } from './Data/Data'; | ||
export { default as Account } from './Account/Account'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export default function ExperimentIcon() { | ||
return ( | ||
<svg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
className="icon-sm" | ||
> | ||
<path | ||
d="M9 3H15M9 3V9.2759C9 9.74377 8.83597 10.1968 8.53644 10.5563L4.85085 14.979C4.30108 15.6387 4 16.4703 4 17.3291V17.3291C4 19.3565 5.64353 21 7.67094 21H16.3291C18.3565 21 20 19.3565 20 17.3291V17.3291C20 16.4703 19.6989 15.6387 19.1492 14.979L15.4636 10.5563C15.164 10.1968 15 9.74377 15 9.2759V3M9 3H8M15 3H16" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
></path> | ||
<path | ||
d="M5 14.774C11.5 12.839 12.15 16.7089 18 14" | ||
stroke="currentColor" | ||
strokeWidth="2" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
></path> | ||
</svg> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.