Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

fix: strict typescript issue, plugins localStorage, both causing App Errors (#765)

Danny Avila92f87b8dcc05
diff --git a/client/src/components/Endpoints/EditPresetDialog.tsx b/client/src/components/Endpoints/EditPresetDialog.tsx
index 2dd2456d8b..4fd1d5a8be 100644
--- a/client/src/components/Endpoints/EditPresetDialog.tsx
+++ b/client/src/components/Endpoints/EditPresetDialog.tsx
@@ -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);
diff --git a/client/src/components/Endpoints/Settings/AgentSettings.tsx b/client/src/components/Endpoints/Settings/AgentSettings.tsx
index f6dde6f06f..2818abb7a8 100644
--- a/client/src/components/Endpoints/Settings/AgentSettings.tsx
+++ b/client/src/components/Endpoints/Settings/AgentSettings.tsx
@@ -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}
diff --git a/client/src/components/Input/ModelSelect/Plugins.tsx b/client/src/components/Input/ModelSelect/Plugins.tsx
index d4515c8700..904fb6db30 100644
--- a/client/src/components/Input/ModelSelect/Plugins.tsx
+++ b/client/src/components/Input/ModelSelect/Plugins.tsx
@@ -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),
);
diff --git a/client/src/hooks/usePresetOptions.ts b/client/src/hooks/usePresetOptions.ts
index 0bf3a6645e..ffa8206d21 100644
--- a/client/src/hooks/usePresetOptions.ts
+++ b/client/src/hooks/usePresetOptions.ts
@@ -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;
diff --git a/packages/data-provider/src/schemas.ts b/packages/data-provider/src/schemas.ts
index dda6ad22b7..435b0f7f5f 100644
--- a/packages/data-provider/src/schemas.ts
+++ b/packages/data-provider/src/schemas.ts
@@ -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(),