mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-08-03 22:32:42 +00:00
🚪 fix: Gate Artifacts Toggle on Agent Capability Flag (#13665)
* fix: hide artifacts toggle when capability is disabled The artifacts badge ignored the agent capabilities config, so a pinned toggle stayed visible after the artifacts capability was turned off. Gate the component on artifactsEnabled via useAgentCapabilities, matching how Skills, FileSearch and CodeInterpreter already handle their capability. * style: fix import order in Artifacts.tsx * style: Sort mutation type imports --------- Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
dfc1178031
commit
8824e8f918
1 changed files with 10 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue