mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
fix: strict typescript issue, plugins localStorage, both causing App Errors (#765)
* fix(Enum): cannot be used as a value when imported as type * hotfix(types): corrected types, some causing application error (bing null model) * hotfix(Plugins): fix undefined localStorage item causing Application error
This commit is contained in:
parent
06a7fba39b
commit
92f87b8dcc
5 changed files with 10 additions and 6 deletions
|
@ -3,7 +3,7 @@ import { useEffect } from 'react';
|
|||
import filenamify from 'filenamify';
|
||||
import exportFromJSON from 'export-from-json';
|
||||
import { useSetRecoilState, useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { EditPresetProps } from 'librechat-data-provider';
|
||||
import { TEditPresetProps } from '~/common';
|
||||
import { useSetOptions, useLocalize } from '~/hooks';
|
||||
import { Input, Label, Dropdown, Dialog, DialogClose, DialogButton } from '~/components/';
|
||||
import DialogTemplate from '~/components/ui/DialogTemplate';
|
||||
|
@ -12,7 +12,7 @@ import EndpointSettings from './EndpointSettings';
|
|||
import { cn, defaultTextProps, removeFocusOutlines, cleanupPreset } from '~/utils/';
|
||||
import store from '~/store';
|
||||
|
||||
const EditPresetDialog = ({ open, onOpenChange, preset: _preset, title }: EditPresetProps) => {
|
||||
const EditPresetDialog = ({ open, onOpenChange, preset: _preset, title }: TEditPresetProps) => {
|
||||
const [preset, setPreset] = useRecoilState(store.preset);
|
||||
const setPresets = useSetRecoilState(store.presets);
|
||||
const availableEndpoints = useRecoilValue(store.availableEndpoints);
|
||||
|
|
|
@ -75,7 +75,7 @@ export default function Settings({ conversation, setOption, models, readonly }:
|
|||
<Slider
|
||||
disabled={readonly}
|
||||
value={[temperature ?? 0]}
|
||||
onValueChange={(value) => setTemperature(value[0])}
|
||||
onValueChange={(value: number[]) => setTemperature(value[0])}
|
||||
doubleClickHandler={() => setTemperature(1)}
|
||||
max={2}
|
||||
min={0}
|
||||
|
|
|
@ -51,7 +51,11 @@ export default function Plugins({ conversation, setOption, models }: TModelSelec
|
|||
.filter((el): el is TPlugin => el !== undefined);
|
||||
|
||||
/* Filter Last Selected Tools */
|
||||
const lastSelectedTools = JSON.parse(localStorage.getItem('lastSelectedTools') ?? '');
|
||||
const localStorageItem = localStorage.getItem('lastSelectedTools');
|
||||
if (!localStorageItem) {
|
||||
return setAvailableTools([...tools, pluginStore]);
|
||||
}
|
||||
const lastSelectedTools = JSON.parse(localStorageItem);
|
||||
const filteredTools = lastSelectedTools.filter((tool: TPlugin) =>
|
||||
tools.some((existingTool) => existingTool.pluginKey === tool.pluginKey),
|
||||
);
|
||||
|
|
|
@ -91,7 +91,7 @@ const usePresetOptions: TUsePresetOptions = (_preset) => {
|
|||
);
|
||||
};
|
||||
|
||||
const setAgentOption: SetOption = (param) => (newValue) => {
|
||||
const setAgentOption: TSetOption = (param) => (newValue) => {
|
||||
const editablePreset = JSON.parse(JSON.stringify(_preset));
|
||||
const { agentOptions } = editablePreset;
|
||||
agentOptions[param] = newValue;
|
||||
|
|
|
@ -81,7 +81,7 @@ export const tConversationSchema = z.object({
|
|||
examples: z.array(tExampleSchema).optional(),
|
||||
chatGptLabel: z.string().nullable().optional(),
|
||||
userLabel: z.string().optional(),
|
||||
model: z.string().optional(),
|
||||
model: z.string().nullable().optional(),
|
||||
promptPrefix: z.string().nullable().optional(),
|
||||
temperature: z.number().optional(),
|
||||
topP: z.number().optional(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue