import { EModelEndpoint } from 'librechat-data-provider'; import { MessagesSquared, GPTIcon } from '~/components/svg'; import { useRecoilState } from 'recoil'; import { Button } from '~/components'; import { cn } from '~/utils/'; import store from '~/store'; type TPopoverButton = { label: string; buttonClass: string; handler: () => void; icon: React.ReactNode; }; export default function PopoverButtons({ endpoint, buttonClass, iconClass = '', }: { endpoint: EModelEndpoint; buttonClass?: string; iconClass?: string; }) { const [optionSettings, setOptionSettings] = useRecoilState(store.optionSettings); const [showAgentSettings, setShowAgentSettings] = useRecoilState(store.showAgentSettings); const { showExamples, isCodeChat } = optionSettings; const triggerExamples = () => setOptionSettings((prev) => ({ ...prev, showExamples: !prev.showExamples })); const buttons: { [key: string]: TPopoverButton[] } = { google: [ { label: (showExamples ? 'Hide' : 'Show') + ' Examples', buttonClass: isCodeChat ? 'disabled' : '', handler: triggerExamples, icon: , }, ], gptPlugins: [ { label: `Show ${showAgentSettings ? 'Completion' : 'Agent'} Settings`, buttonClass: '', handler: () => setShowAgentSettings((prev) => !prev), icon: , }, ], }; const endpointButtons = buttons[endpoint]; if (!endpointButtons) { return null; } return (
{endpointButtons.map((button, index) => ( ))}
); }