mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-25 12:48:53 +01:00
feat: Integrate agentsMap into EndpointIcon for agent avatar rendering
This commit is contained in:
parent
959e301f99
commit
087ffa972e
2 changed files with 12 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ import type { TConversation } from 'librechat-data-provider';
|
|||
import { useUpdateConversationMutation } from '~/data-provider';
|
||||
import EndpointIcon from '~/components/Endpoints/EndpointIcon';
|
||||
import { useNavigateToConvo, useLocalize, useShiftKey } from '~/hooks';
|
||||
import { useAgentsMapContext } from '~/Providers/AgentsMapContext';
|
||||
import { useGetEndpointsQuery } from '~/data-provider';
|
||||
import { NotificationSeverity } from '~/common';
|
||||
import { ConvoOptions } from './ConvoOptions';
|
||||
|
|
@ -25,6 +26,7 @@ export default function Conversation({ conversation, retainView, toggleNav }: Co
|
|||
const params = useParams();
|
||||
const localize = useLocalize();
|
||||
const { showToast } = useToastContext();
|
||||
const agentsMap = useAgentsMapContext();
|
||||
const { navigateToConvo } = useNavigateToConvo();
|
||||
const { data: endpointsConfig } = useGetEndpointsQuery();
|
||||
const currentConvoId = useMemo(() => params.conversationId, [params.conversationId]);
|
||||
|
|
@ -183,6 +185,7 @@ export default function Conversation({ conversation, retainView, toggleNav }: Co
|
|||
<EndpointIcon
|
||||
conversation={conversation}
|
||||
endpointsConfig={endpointsConfig}
|
||||
agentsMap={agentsMap}
|
||||
size={20}
|
||||
context="menu-item"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { getEndpointField, isAssistantsEndpoint } from 'librechat-data-provider';
|
||||
import { getEndpointField, isAssistantsEndpoint, EModelEndpoint } from 'librechat-data-provider';
|
||||
import type {
|
||||
TPreset,
|
||||
TAgentsMap,
|
||||
TConversation,
|
||||
TAssistantsMap,
|
||||
TEndpointsConfig,
|
||||
|
|
@ -14,6 +15,7 @@ export default function EndpointIcon({
|
|||
endpointsConfig,
|
||||
className = 'mr-0',
|
||||
assistantMap,
|
||||
agentsMap,
|
||||
context,
|
||||
}: {
|
||||
conversation: TConversation | TPreset | null;
|
||||
|
|
@ -21,6 +23,7 @@ export default function EndpointIcon({
|
|||
containerClassName?: string;
|
||||
context?: 'message' | 'nav' | 'landing' | 'menu-item';
|
||||
assistantMap?: TAssistantsMap;
|
||||
agentsMap?: TAgentsMap;
|
||||
className?: string;
|
||||
size?: number;
|
||||
}) {
|
||||
|
|
@ -37,7 +40,11 @@ export default function EndpointIcon({
|
|||
const assistantAvatar = (assistant && (assistant.metadata?.avatar as string)) || '';
|
||||
const assistantName = assistant && (assistant.name ?? '');
|
||||
|
||||
const iconURL = assistantAvatar || convoIconURL;
|
||||
const agent =
|
||||
endpoint === EModelEndpoint.agents ? agentsMap?.[conversation?.agent_id ?? ''] : null;
|
||||
const agentAvatar = agent?.avatar?.filepath ?? '';
|
||||
|
||||
const iconURL = assistantAvatar || agentAvatar || convoIconURL;
|
||||
|
||||
if (iconURL && (iconURL.includes('http') || iconURL.startsWith('/images/'))) {
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue