mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-29 22:05:18 +01:00
16 lines
649 B
TypeScript
16 lines
649 B
TypeScript
|
|
import { useCallback } from 'react';
|
||
|
|
import { getResponseSender } from 'librechat-data-provider';
|
||
|
|
import { useGetEndpointsQuery } from 'librechat-data-provider/react-query';
|
||
|
|
import type { TEndpointOption, TEndpointsConfig } from 'librechat-data-provider';
|
||
|
|
|
||
|
|
export default function useGetSender() {
|
||
|
|
const { data: endpointsConfig = {} as TEndpointsConfig } = useGetEndpointsQuery();
|
||
|
|
return useCallback(
|
||
|
|
(endpointOption: TEndpointOption) => {
|
||
|
|
const { modelDisplayLabel } = endpointsConfig[endpointOption.endpoint ?? ''] ?? {};
|
||
|
|
return getResponseSender({ ...endpointOption, modelDisplayLabel });
|
||
|
|
},
|
||
|
|
[endpointsConfig],
|
||
|
|
);
|
||
|
|
}
|