diff --git a/client/src/components/Chat/Input/Artifacts.tsx b/client/src/components/Chat/Input/Artifacts.tsx index bd40639986..ddc36eb7ee 100644 --- a/client/src/components/Chat/Input/Artifacts.tsx +++ b/client/src/components/Chat/Input/Artifacts.tsx @@ -1,10 +1,10 @@ import React, { memo, useState, useCallback, useMemo, useEffect } from 'react'; import * as Ariakit from '@ariakit/react'; import { CheckboxButton } from '@librechat/client'; -import { ArtifactModes } from 'librechat-data-provider'; import { WandSparkles, ChevronDown } from 'lucide-react'; +import { ArtifactModes, defaultAgentCapabilities } from 'librechat-data-provider'; +import { useLocalize, useAgentCapabilities } from '~/hooks'; import { useBadgeRowContext } from '~/Providers'; -import { useLocalize } from '~/hooks'; import { cn } from '~/utils'; interface ArtifactsToggleState { @@ -17,6 +17,10 @@ function Artifacts() { const context = useBadgeRowContext(); const { toggleState, debouncedChange, isPinned } = context?.artifacts ?? {}; + const { artifactsEnabled } = useAgentCapabilities( + context?.agentsConfig?.capabilities ?? defaultAgentCapabilities, + ); + const [isPopoverOpen, setIsPopoverOpen] = useState(false); const [isButtonExpanded, setIsButtonExpanded] = useState(false); @@ -73,6 +77,10 @@ function Artifacts() { } }, [isCustomEnabled, debouncedChange]); + if (!artifactsEnabled) { + return null; + } + if (!isEnabled && !isPinned) { return null; }