From 92f87b8dcc05fc80b69d7252dfbfa611814f28ef Mon Sep 17 00:00:00 2001 From: Danny Avila <110412045+danny-avila@users.noreply.github.com> Date: Sun, 6 Aug 2023 11:26:37 -0400 Subject: [PATCH 1/2] 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 --- client/src/components/Endpoints/EditPresetDialog.tsx | 4 ++-- client/src/components/Endpoints/Settings/AgentSettings.tsx | 2 +- client/src/components/Input/ModelSelect/Plugins.tsx | 6 +++++- client/src/hooks/usePresetOptions.ts | 2 +- packages/data-provider/src/schemas.ts | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) 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 }: 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(), From 600a0d15b152a6e6db5e9cc59d9799fdea78f0d4 Mon Sep 17 00:00:00 2001 From: Danny Avila <110412045+danny-avila@users.noreply.github.com> Date: Sun, 6 Aug 2023 13:08:23 -0400 Subject: [PATCH 2/2] fix(backend-review.yml): update Node.js version from 19.x to 20.x (#767) fix(frontend-review.yml): update Node.js version from 19.x to 20.x --- .github/workflows/backend-review.yml | 4 ++-- .github/workflows/frontend-review.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/backend-review.yml b/.github/workflows/backend-review.yml index 11b4b562c0..3e9afa2e09 100644 --- a/.github/workflows/backend-review.yml +++ b/.github/workflows/backend-review.yml @@ -23,10 +23,10 @@ jobs: CREDS_IV: ${{ secrets.CREDS_IV }} steps: - uses: actions/checkout@v2 - - name: Use Node.js 19.x + - name: Use Node.js 20.x uses: actions/setup-node@v3 with: - node-version: 19.x + node-version: 20 cache: 'npm' - name: Install dependencies diff --git a/.github/workflows/frontend-review.yml b/.github/workflows/frontend-review.yml index acc43b503e..1401af97f4 100644 --- a/.github/workflows/frontend-review.yml +++ b/.github/workflows/frontend-review.yml @@ -18,10 +18,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Use Node.js 19.x + - name: Use Node.js 20.x uses: actions/setup-node@v3 with: - node-version: 19.x + node-version: 20 cache: 'npm' - name: Install dependencies