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:
Dan Orlando 2023-08-05 13:45:26 -07:00 committed by GitHub
parent 5828200197
commit 96d29f7390
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 233 additions and 245 deletions

View file

@ -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;