import { useFormContext } from 'react-hook-form'; import { ArtifactModes, AgentCapabilities } from 'librechat-data-provider'; import { Switch, HoverCard, HoverCardPortal, HoverCardContent, HoverCardTrigger, CircleHelpIcon, } from '@librechat/client'; import type { AgentForm } from '~/common'; import { useLocalize } from '~/hooks'; import { ESide } from '~/common'; export default function Artifacts() { const localize = useLocalize(); const methods = useFormContext(); const { setValue, watch } = methods; const artifactsMode = watch(AgentCapabilities.artifacts); const handleArtifactsChange = (value: boolean) => { setValue(AgentCapabilities.artifacts, value ? ArtifactModes.DEFAULT : '', { shouldDirty: true, }); }; const handleShadcnuiChange = (value: boolean) => { setValue(AgentCapabilities.artifacts, value ? ArtifactModes.SHADCNUI : ArtifactModes.DEFAULT, { shouldDirty: true, }); }; const handleCustomModeChange = (value: boolean) => { setValue(AgentCapabilities.artifacts, value ? ArtifactModes.CUSTOM : ArtifactModes.DEFAULT, { shouldDirty: true, }); }; const isEnabled = artifactsMode !== undefined && artifactsMode !== ''; const isCustomEnabled = artifactsMode === ArtifactModes.CUSTOM; const isShadcnEnabled = artifactsMode === ArtifactModes.SHADCNUI; return (
); } function SwitchItem({ id, label, checked, onCheckedChange, hoverCardText, disabled = false, }: { id: string; label: string; checked: boolean; onCheckedChange: (value: boolean) => void; hoverCardText: string; disabled?: boolean; }) { return (
{label}

{hoverCardText}

); }