mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 08:12:00 +02:00
🔧 fix: EndpointIcon crash when using @
mention command (#3742)
This commit is contained in:
parent
596ecc6969
commit
366e4c5adb
1 changed files with 32 additions and 30 deletions
|
@ -31,40 +31,42 @@ export default function EndpointIcon({
|
|||
const endpointType = getEndpointField(endpointsConfig, endpoint, 'type');
|
||||
const endpointIconURL = getEndpointField(endpointsConfig, endpoint, 'iconURL');
|
||||
|
||||
const assistant =
|
||||
isAssistantsEndpoint(endpoint) && assistantMap?.[endpoint]?.[conversation?.assistant_id ?? ''];
|
||||
const assistantAvatar = (assistant && (assistant?.metadata?.avatar as string)) || '';
|
||||
const assistantName = (assistant && assistant?.name) || '';
|
||||
const assistant = isAssistantsEndpoint(endpoint)
|
||||
? assistantMap?.[endpoint]?.[conversation?.assistant_id ?? '']
|
||||
: null;
|
||||
const assistantAvatar = (assistant && (assistant.metadata?.avatar as string)) || '';
|
||||
const assistantName = assistant && (assistant.name ?? '');
|
||||
|
||||
const iconURL = assistantAvatar || convoIconURL;
|
||||
|
||||
let icon: React.ReactNode | null = null;
|
||||
if (iconURL && (iconURL.includes('http') || iconURL.startsWith('/images/'))) {
|
||||
icon = ConvoIconURL({
|
||||
preset: {
|
||||
...(conversation as TPreset),
|
||||
iconURL,
|
||||
},
|
||||
context,
|
||||
endpointIconURL,
|
||||
assistantAvatar,
|
||||
assistantName,
|
||||
});
|
||||
return (
|
||||
<ConvoIconURL
|
||||
preset={{
|
||||
...(conversation as TPreset),
|
||||
iconURL,
|
||||
}}
|
||||
context={context}
|
||||
endpointIconURL={endpointIconURL}
|
||||
assistantAvatar={assistantAvatar}
|
||||
assistantName={assistantName ?? ''}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
icon = MinimalIcon({
|
||||
size: 20,
|
||||
iconURL: endpointIconURL,
|
||||
endpoint,
|
||||
endpointType,
|
||||
model: conversation?.model,
|
||||
error: false,
|
||||
className,
|
||||
isCreatedByUser: false,
|
||||
chatGptLabel: undefined,
|
||||
modelLabel: undefined,
|
||||
jailbreak: undefined,
|
||||
});
|
||||
return (
|
||||
<MinimalIcon
|
||||
size={20}
|
||||
iconURL={endpointIconURL}
|
||||
endpoint={endpoint}
|
||||
endpointType={endpointType}
|
||||
model={conversation?.model}
|
||||
error={false}
|
||||
className={className}
|
||||
isCreatedByUser={false}
|
||||
chatGptLabel={undefined}
|
||||
modelLabel={undefined}
|
||||
jailbreak={undefined}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue