import React from 'react'; import ReactMarkdown from 'react-markdown'; import TagManager from 'react-gtm-module'; import { Constants } from 'librechat-data-provider'; import { useGetStartupConfig } from 'librechat-data-provider/react-query'; import { useLocalize } from '~/hooks'; export default function Footer({ className }: { className?: string }) { const { data: config } = useGetStartupConfig(); const localize = useLocalize(); const privacyPolicy = config?.interface?.privacyPolicy; const termsOfService = config?.interface?.termsOfService; const privacyPolicyRender = privacyPolicy?.externalUrl != null && ( {localize('com_ui_privacy_policy')} ); const termsOfServiceRender = termsOfService?.externalUrl != null && ( {localize('com_ui_terms_of_service')} ); if (config?.analyticsGtmId != null) { const tagManagerArgs = { gtmId: config.analyticsGtmId, }; TagManager.initialize(tagManagerArgs); } const mainContentParts = ( typeof config?.customFooter === 'string' ? config.customFooter : '[LibreChat ' + Constants.VERSION + '](https://librechat.ai) - ' + localize('com_ui_latest_footer') ).split('|'); const mainContentRender = mainContentParts.map((text, index) => ( { return ( {children} ); }, // eslint-disable-next-line @typescript-eslint/no-unused-vars p: ({ node: _n, ...props }) => , }} > {text.trim()} )); const footerElements = [...mainContentRender, privacyPolicyRender, termsOfServiceRender].filter( Boolean, ); return (
{footerElements.map((contentRender, index) => { const isLastElement = index === footerElements.length - 1; return ( {contentRender} {!isLastElement && (
)} ); })}
); }