mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-29 14:48:51 +01:00
* feat: add filterFilesByEndpointConfig to filter disabled file processing by provider * chore: explicit define of endpointFileConfig for better debugging * refactor: move `normalizeEndpointName` to data-provider as used app-wide * chore: remove overrideEndpoint from useFileHandling * refactor: improve endpoint file config selection * refactor: update filterFilesByEndpointConfig to accept structured parameters and improve endpoint file config handling * refactor: replace defaultFileConfig with getEndpointFileConfig for improved file configuration handling across components * test: add comprehensive unit tests for getEndpointFileConfig to validate endpoint configuration handling * refactor: streamline agent endpoint assignment and improve file filtering logic * feat: add error handling for disabled file uploads in endpoint configuration * refactor: update encodeAndFormat functions to accept structured parameters for provider and endpoint * refactor: streamline requestFiles handling in initializeAgent function * fix: getEndpointFileConfig partial config merging scenarios * refactor: enhance mergeWithDefault function to support document-supported providers with comprehensive MIME types * refactor: user-configured default file config in getEndpointFileConfig * fix: prevent file handling when endpoint is disabled and file is dragged to chat * refactor: move `getEndpointField` to `data-provider` and update usage across components and hooks * fix: prioritize endpointType based on agent.endpoint in file filtering logic * fix: prioritize agent.endpoint in file filtering logic and remove unnecessary endpointType defaulting
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import { useRecoilValue } from 'recoil';
|
|
import { useGetModelsQuery } from 'librechat-data-provider/react-query';
|
|
import { getEndpointField, SettingsViews } from 'librechat-data-provider';
|
|
import type { TConversation } from 'librechat-data-provider';
|
|
import type { TSettingsProps } from '~/common';
|
|
import { useGetEndpointsQuery } from '~/data-provider';
|
|
import { getSettings } from './Settings';
|
|
import { cn } from '~/utils';
|
|
import store from '~/store';
|
|
|
|
export default function Settings({
|
|
conversation,
|
|
setOption,
|
|
isPreset = false,
|
|
className = '',
|
|
}: TSettingsProps) {
|
|
const modelsQuery = useGetModelsQuery();
|
|
const { data: endpointsConfig } = useGetEndpointsQuery();
|
|
const currentSettingsView = useRecoilValue(store.currentSettingsView);
|
|
const endpointType = getEndpointField(endpointsConfig, conversation?.endpoint ?? '', 'type');
|
|
const endpoint = endpointType ?? conversation?.endpoint ?? '';
|
|
if (!endpoint || currentSettingsView !== SettingsViews.default) {
|
|
return null;
|
|
}
|
|
|
|
const { settings, multiViewSettings } = getSettings();
|
|
const { endpoint: _endpoint } = conversation as TConversation;
|
|
const models = modelsQuery.data?.[_endpoint ?? ''] ?? [];
|
|
const OptionComponent = settings[endpoint];
|
|
|
|
if (OptionComponent) {
|
|
return (
|
|
<div className={cn('h-[500px] overflow-y-auto md:mb-2 md:h-[350px]', className)}>
|
|
<OptionComponent
|
|
conversation={conversation}
|
|
setOption={setOption}
|
|
models={models}
|
|
isPreset={isPreset}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const MultiViewComponent = multiViewSettings[endpoint];
|
|
|
|
if (MultiViewComponent == null) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className={cn('hide-scrollbar h-[500px] overflow-y-auto md:mb-2 md:h-[350px]', className)}>
|
|
<MultiViewComponent conversation={conversation} models={models} isPreset={isPreset} />
|
|
</div>
|
|
);
|
|
}
|