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

@ -0,0 +1 @@
export * from './types';

View file

@ -0,0 +1,50 @@
import { TConversation, TPreset } from 'librechat-data-provider';
export type TSetOption = (param: number | string) => (newValue: number | string | boolean) => void;
export type TSetExample = (
i: number,
type: string,
newValue: number | string | boolean | null,
) => void;
export enum ESide {
Top = 'top',
Right = 'right',
Bottom = 'bottom',
Left = 'left',
}
export type TBaseSettingsProps = {
conversation: TConversation | TPreset | null;
className?: string;
isPreset?: boolean;
readonly?: boolean;
};
export type TSettingsProps = TBaseSettingsProps & {
setOption: TSetOption;
};
export type TModels = {
models: string[];
};
export type TModelSelectProps = TSettingsProps & TModels;
export type TEditPresetProps = {
open: boolean;
onOpenChange: React.Dispatch<React.SetStateAction<boolean>>;
preset: TPreset;
title?: string;
};
export type TSetOptionsPayload = {
setOption: TSetOption;
setExample: TSetExample;
addExample: () => void;
removeExample: () => void;
setAgentOption: TSetOption;
getConversation: () => TConversation | TPreset | null;
checkPluginSelection: (value: string) => boolean;
setTools: (newValue: string) => void;
};