mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-27 04:44:10 +01:00
🔧 fix: Improve Endpoint Handling and Address Edge Cases (#1486)
* fix(TEndpointsConfig): resolve property access issues with typesafe helper function * fix: undefined or null endpoint edge case * refactor(mapEndpoints -> endpoints): renamed module to be more general for endpoint handling, wrote unit tests, export all helpers
This commit is contained in:
parent
42f2353509
commit
9864fc8700
24 changed files with 275 additions and 99 deletions
|
|
@ -5,6 +5,7 @@ import type { TMessage } from 'librechat-data-provider';
|
|||
import type { TMessageProps } from '~/common';
|
||||
import Icon from '~/components/Endpoints/Icon';
|
||||
import { useChatContext } from '~/Providers';
|
||||
import { getEndpointField } from '~/utils';
|
||||
|
||||
export default function useMessageHelpers(props: TMessageProps) {
|
||||
const latestText = useRef('');
|
||||
|
|
@ -53,7 +54,7 @@ export default function useMessageHelpers(props: TMessageProps) {
|
|||
const icon = Icon({
|
||||
...conversation,
|
||||
...(message as TMessage),
|
||||
iconURL: endpointsConfig?.[conversation?.endpoint ?? '']?.iconURL,
|
||||
iconURL: getEndpointField(endpointsConfig, conversation?.endpoint, 'iconURL'),
|
||||
model: message?.model ?? conversation?.model,
|
||||
size: 28.8,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue