From f8067e91d4adf7be9e0d9e914aaae79ac4689b80 Mon Sep 17 00:00:00 2001 From: Danny Avila Date: Wed, 4 Sep 2024 22:07:28 -0400 Subject: [PATCH] wip: params --- .../components/SidePanel/Parameters/Panel.tsx | 13 +++++++++- client/src/hooks/Nav/useSideNavLinks.ts | 24 +++++++++---------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/client/src/components/SidePanel/Parameters/Panel.tsx b/client/src/components/SidePanel/Parameters/Panel.tsx index b118388b7f..97d26fb7de 100644 --- a/client/src/components/SidePanel/Parameters/Panel.tsx +++ b/client/src/components/SidePanel/Parameters/Panel.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { useForm, FormProvider } from 'react-hook-form'; import { ComponentTypes } from 'librechat-data-provider'; import type { DynamicSettingProps, SettingsConfiguration } from 'librechat-data-provider'; @@ -166,6 +166,17 @@ export default function Parameters() { }, {} as Record), }); + const { + formState: { isDirty }, + } = methods; + + useEffect(() => { + if (isDirty) { + console.log('The form has been edited'); + // You can perform any action here when the form becomes dirty + } + }, [isDirty]); + // eslint-disable-next-line @typescript-eslint/no-explicit-any const onSubmit = (data: Record) => { console.log('Form data:', data); diff --git a/client/src/hooks/Nav/useSideNavLinks.ts b/client/src/hooks/Nav/useSideNavLinks.ts index a47a075362..a6da9ed39e 100644 --- a/client/src/hooks/Nav/useSideNavLinks.ts +++ b/client/src/hooks/Nav/useSideNavLinks.ts @@ -76,18 +76,18 @@ export default function useSideNavLinks({ }); } - // if ( - // isAgentsEndpoint(endpoint) || - // (endpoint === EModelEndpoint.bedrock && interfaceConfig.parameters === true && keyProvided) - // ) { - // links.push({ - // title: 'com_sidepanel_parameters', - // label: '', - // icon: Settings2, - // id: 'parameters', - // Component: Parameters, - // }); - // } + if ( + isAgentsEndpoint(endpoint) || + (endpoint === EModelEndpoint.bedrock && interfaceConfig.parameters === true && keyProvided) + ) { + links.push({ + title: 'com_sidepanel_parameters', + label: '', + icon: Settings2, + id: 'parameters', + Component: Parameters, + }); + } if (hasAccessToPrompts) { links.push({