mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 18:00:15 +01:00
👩💻 fix: Minor UI fixes (#2548)
* fix(useMessageHelpers): define iconEndpoint * fix: rely on Assistant Switcher effect for defining `assistant_id`, ensure ChatRoute `newConversation` only fires once
This commit is contained in:
parent
4d0806d3e8
commit
2720327aa1
3 changed files with 6 additions and 3 deletions
|
|
@ -27,6 +27,7 @@ export default function AssistantSwitcher({ isCollapsed }: SwitcherProps) {
|
||||||
const assistant_id =
|
const assistant_id =
|
||||||
localStorage.getItem(`assistant_id__${index}`) ?? assistants[0]?.id ?? '';
|
localStorage.getItem(`assistant_id__${index}`) ?? assistants[0]?.id ?? '';
|
||||||
const assistant = assistantMap?.[assistant_id];
|
const assistant = assistantMap?.[assistant_id];
|
||||||
|
|
||||||
if (!assistant) {
|
if (!assistant) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -34,6 +35,7 @@ export default function AssistantSwitcher({ isCollapsed }: SwitcherProps) {
|
||||||
if (endpoint !== EModelEndpoint.assistants) {
|
if (endpoint !== EModelEndpoint.assistants) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setOption('model')(assistant.model);
|
setOption('model')(assistant.model);
|
||||||
setOption('assistant_id')(assistant_id);
|
setOption('assistant_id')(assistant_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,12 @@ export default function useMessageHelpers(props: TMessageProps) {
|
||||||
const assistant =
|
const assistant =
|
||||||
conversation?.endpoint === EModelEndpoint.assistants && assistantMap?.[message?.model ?? ''];
|
conversation?.endpoint === EModelEndpoint.assistants && assistantMap?.[message?.model ?? ''];
|
||||||
|
|
||||||
|
const iconEndpoint = message?.endpoint ?? conversation?.endpoint;
|
||||||
const icon = Icon({
|
const icon = Icon({
|
||||||
...conversation,
|
...conversation,
|
||||||
...(message as TMessage),
|
...(message as TMessage),
|
||||||
iconURL: !assistant
|
iconURL: !assistant
|
||||||
? getEndpointField(endpointsConfig, conversation?.endpoint, 'iconURL')
|
? getEndpointField(endpointsConfig, iconEndpoint, 'iconURL')
|
||||||
: (assistant?.metadata?.avatar as string | undefined) ?? '',
|
: (assistant?.metadata?.avatar as string | undefined) ?? '',
|
||||||
model: message?.model ?? conversation?.model,
|
model: message?.model ?? conversation?.model,
|
||||||
assistantName: assistant ? (assistant.name as string | undefined) : '',
|
assistantName: assistant ? (assistant.name as string | undefined) : '',
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export default function ChatRoute() {
|
||||||
modelsData: modelsQuery.data,
|
modelsData: modelsQuery.data,
|
||||||
template: conversation ? conversation : undefined,
|
template: conversation ? conversation : undefined,
|
||||||
});
|
});
|
||||||
hasSetConversation.current = !!assistants;
|
hasSetConversation.current = true;
|
||||||
} else if (
|
} else if (
|
||||||
initialConvoQuery.data &&
|
initialConvoQuery.data &&
|
||||||
endpointsQuery.data &&
|
endpointsQuery.data &&
|
||||||
|
|
@ -73,7 +73,7 @@ export default function ChatRoute() {
|
||||||
modelsData: modelsQuery.data,
|
modelsData: modelsQuery.data,
|
||||||
keepLatestMessage: true,
|
keepLatestMessage: true,
|
||||||
});
|
});
|
||||||
hasSetConversation.current = !!assistants;
|
hasSetConversation.current = true;
|
||||||
} else if (
|
} else if (
|
||||||
!hasSetConversation.current &&
|
!hasSetConversation.current &&
|
||||||
!modelsQuery.data?.initial &&
|
!modelsQuery.data?.initial &&
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue