mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-30 14:25:19 +01:00
fix: add optional chaining to prevent runtime errors in various components
This commit is contained in:
parent
670f9b8daf
commit
bd3f5f1e77
5 changed files with 5 additions and 5 deletions
|
|
@ -150,7 +150,7 @@ export const a: React.ElementType = memo(({ href, children }: TAnchorProps) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={filepath.startsWith('files/') ? `/api/${filepath}` : `/api/files/${filepath}`}
|
href={filepath?.startsWith('files/') ? `/api/${filepath}` : `/api/files/${filepath}`}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ export default function EndpointIcon({
|
||||||
isCreatedByUser={false}
|
isCreatedByUser={false}
|
||||||
chatGptLabel={undefined}
|
chatGptLabel={undefined}
|
||||||
modelLabel={undefined}
|
modelLabel={undefined}
|
||||||
jailbreak={undefined}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ export default function GroupSidePanel({
|
||||||
} & ReturnType<typeof usePromptGroupsNav>) {
|
} & ReturnType<typeof usePromptGroupsNav>) {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isSmallerScreen = useMediaQuery('(max-width: 1024px)');
|
const isSmallerScreen = useMediaQuery('(max-width: 1024px)');
|
||||||
const isChatRoute = useMemo(() => location.pathname.startsWith('/c/'), [location.pathname]);
|
const isChatRoute = useMemo(() => location.pathname?.startsWith('/c/'), [location.pathname]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export default function PanelFileCell({ row }: { row: Row<TFile | undefined> })
|
||||||
const file = row.original;
|
const file = row.original;
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full items-center gap-2">
|
<div className="flex w-full items-center gap-2">
|
||||||
{file?.type.startsWith('image') === true ? (
|
{file?.type?.startsWith('image') === true ? (
|
||||||
<ImagePreview
|
<ImagePreview
|
||||||
url={file.filepath}
|
url={file.filepath}
|
||||||
className="h-10 w-10 flex-shrink-0"
|
className="h-10 w-10 flex-shrink-0"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ const ModelParameters: React.FC<ModelParametersProps> = ({
|
||||||
const rangeRef = useRef<HTMLInputElement>(null);
|
const rangeRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
const id = `model-parameter-${ariaLabel.toLowerCase().replace(/\s+/g, '-')}`;
|
const id = `model-parameter-${ariaLabel.toLowerCase().replace(/\s+/g, '-')}`;
|
||||||
const displayLabel = label.startsWith('com_') ? localize(label as TranslationKeys) : label;
|
const displayLabel =
|
||||||
|
label && label.startsWith('com_') ? localize(label as TranslationKeys) : label;
|
||||||
|
|
||||||
const getDecimalPlaces = (num: number) => {
|
const getDecimalPlaces = (num: number) => {
|
||||||
const match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
|
const match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue