mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01: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 endpointType = getEndpointField(endpointsConfig, endpoint, 'type');
|
||||||
const endpointIconURL = getEndpointField(endpointsConfig, endpoint, 'iconURL');
|
const endpointIconURL = getEndpointField(endpointsConfig, endpoint, 'iconURL');
|
||||||
|
|
||||||
const assistant =
|
const assistant = isAssistantsEndpoint(endpoint)
|
||||||
isAssistantsEndpoint(endpoint) && assistantMap?.[endpoint]?.[conversation?.assistant_id ?? ''];
|
? assistantMap?.[endpoint]?.[conversation?.assistant_id ?? '']
|
||||||
const assistantAvatar = (assistant && (assistant?.metadata?.avatar as string)) || '';
|
: null;
|
||||||
const assistantName = (assistant && assistant?.name) || '';
|
const assistantAvatar = (assistant && (assistant.metadata?.avatar as string)) || '';
|
||||||
|
const assistantName = assistant && (assistant.name ?? '');
|
||||||
|
|
||||||
const iconURL = assistantAvatar || convoIconURL;
|
const iconURL = assistantAvatar || convoIconURL;
|
||||||
|
|
||||||
let icon: React.ReactNode | null = null;
|
|
||||||
if (iconURL && (iconURL.includes('http') || iconURL.startsWith('/images/'))) {
|
if (iconURL && (iconURL.includes('http') || iconURL.startsWith('/images/'))) {
|
||||||
icon = ConvoIconURL({
|
return (
|
||||||
preset: {
|
<ConvoIconURL
|
||||||
...(conversation as TPreset),
|
preset={{
|
||||||
iconURL,
|
...(conversation as TPreset),
|
||||||
},
|
iconURL,
|
||||||
context,
|
}}
|
||||||
endpointIconURL,
|
context={context}
|
||||||
assistantAvatar,
|
endpointIconURL={endpointIconURL}
|
||||||
assistantName,
|
assistantAvatar={assistantAvatar}
|
||||||
});
|
assistantName={assistantName ?? ''}
|
||||||
|
/>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
icon = MinimalIcon({
|
return (
|
||||||
size: 20,
|
<MinimalIcon
|
||||||
iconURL: endpointIconURL,
|
size={20}
|
||||||
endpoint,
|
iconURL={endpointIconURL}
|
||||||
endpointType,
|
endpoint={endpoint}
|
||||||
model: conversation?.model,
|
endpointType={endpointType}
|
||||||
error: false,
|
model={conversation?.model}
|
||||||
className,
|
error={false}
|
||||||
isCreatedByUser: false,
|
className={className}
|
||||||
chatGptLabel: undefined,
|
isCreatedByUser={false}
|
||||||
modelLabel: undefined,
|
chatGptLabel={undefined}
|
||||||
jailbreak: undefined,
|
modelLabel={undefined}
|
||||||
});
|
jailbreak={undefined}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return icon;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue