mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-30 15:18:50 +01:00
refactor(client): Refactors recent typescript changes for best practices (#763)
* create common types in client * remove unnecessary rules from eslint config * cleanup types * put back eslintrc rules
This commit is contained in:
parent
5828200197
commit
96d29f7390
32 changed files with 233 additions and 245 deletions
|
|
@ -6,12 +6,22 @@ import Plugins from './Plugins';
|
|||
import ChatGPT from './ChatGPT';
|
||||
import Anthropic from './Anthropic';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { SelectProps, ModelSelectProps } from 'librechat-data-provider';
|
||||
import type { TConversation } from 'librechat-data-provider';
|
||||
import type { TSetOption, TModelSelectProps } from '~/common';
|
||||
import store from '~/store';
|
||||
|
||||
type OptionComponentType = React.FC<ModelSelectProps>;
|
||||
type TGoogleProps = {
|
||||
showExamples: boolean;
|
||||
isCodeChat: boolean;
|
||||
};
|
||||
|
||||
const optionComponents: { [key: string]: OptionComponentType } = {
|
||||
type TSelectProps = {
|
||||
conversation: TConversation | null;
|
||||
setOption: TSetOption;
|
||||
extraProps?: TGoogleProps;
|
||||
};
|
||||
|
||||
const optionComponents: { [key: string]: React.FC<TModelSelectProps> } = {
|
||||
openAI: OpenAI,
|
||||
azureOpenAI: OpenAI,
|
||||
bingAI: BingAI,
|
||||
|
|
@ -21,7 +31,7 @@ const optionComponents: { [key: string]: OptionComponentType } = {
|
|||
chatGPTBrowser: ChatGPT,
|
||||
};
|
||||
|
||||
export default function ModelSelect({ conversation, setOption }: SelectProps) {
|
||||
export default function ModelSelect({ conversation, setOption }: TSelectProps) {
|
||||
const endpointsConfig = useRecoilValue(store.endpointsConfig);
|
||||
if (!conversation?.endpoint) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue