mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-07 11:08:52 +01:00
🤖 refactor: Side Panel Agent UI To Account For Ephemeral Agents (#9763)
* refactor: Remove unused imports and consolidate ephemeral agent logic * refactor: Side Panel agent handling to account for ephemeral agents for UI * refactor: Replace Constants.EPHEMERAL_AGENT_ID checks with isEphemeralAgent utility for consistency * ci: AgentPanel tests with additional mock configurations and utility functions
This commit is contained in:
parent
a6bf2b6ce3
commit
8a60e8990f
20 changed files with 87 additions and 77 deletions
|
|
@ -1,17 +1,12 @@
|
|||
import { useQuery, useInfiniteQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import {
|
||||
Constants,
|
||||
QueryKeys,
|
||||
dataService,
|
||||
EModelEndpoint,
|
||||
PermissionBits,
|
||||
} from 'librechat-data-provider';
|
||||
import { QueryKeys, dataService, EModelEndpoint, PermissionBits } from 'librechat-data-provider';
|
||||
import type {
|
||||
QueryObserverResult,
|
||||
UseQueryOptions,
|
||||
UseInfiniteQueryOptions,
|
||||
} from '@tanstack/react-query';
|
||||
import type t from 'librechat-data-provider';
|
||||
import { isEphemeralAgent } from '~/common';
|
||||
|
||||
/**
|
||||
* AGENTS
|
||||
|
|
@ -73,11 +68,7 @@ export const useGetAgentByIdQuery = (
|
|||
agent_id: string | null | undefined,
|
||||
config?: UseQueryOptions<t.Agent>,
|
||||
): QueryObserverResult<t.Agent> => {
|
||||
const isValidAgentId = !!(
|
||||
agent_id &&
|
||||
agent_id !== '' &&
|
||||
agent_id !== Constants.EPHEMERAL_AGENT_ID
|
||||
);
|
||||
const isValidAgentId = !!agent_id && !isEphemeralAgent(agent_id);
|
||||
|
||||
return useQuery<t.Agent>(
|
||||
[QueryKeys.agent, agent_id],
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|||
import { QueryKeys, DynamicQueryKeys, dataService } from 'librechat-data-provider';
|
||||
import type { QueryObserverResult, UseQueryOptions } from '@tanstack/react-query';
|
||||
import type t from 'librechat-data-provider';
|
||||
import { isEphemeralAgent } from '~/common';
|
||||
import { addFileToCache } from '~/utils';
|
||||
import store from '~/store';
|
||||
|
||||
|
|
@ -32,7 +33,7 @@ export const useGetAgentFiles = <TData = t.TFile[]>(
|
|||
refetchOnReconnect: false,
|
||||
refetchOnMount: false,
|
||||
...config,
|
||||
enabled: (config?.enabled ?? true) === true && queriesEnabled && !!agentId,
|
||||
enabled: (config?.enabled ?? true) === true && queriesEnabled && !isEphemeralAgent(agentId),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue