From 13ac421cddc3c25ef3ab34324e4add5b80bd35ec Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Fri, 5 Jan 2024 11:22:28 +0700 Subject: [PATCH] fix: copy stream tooltip and hide section when no params setting --- .../Chat/ModelSetting/predefinedComponent.ts | 2 +- web/screens/Chat/Sidebar/index.tsx | 64 +++++++++++-------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/web/screens/Chat/ModelSetting/predefinedComponent.ts b/web/screens/Chat/ModelSetting/predefinedComponent.ts index cc794556d..b8eafa2f1 100644 --- a/web/screens/Chat/ModelSetting/predefinedComponent.ts +++ b/web/screens/Chat/ModelSetting/predefinedComponent.ts @@ -72,7 +72,7 @@ export const presetConfiguration: Record = { stream: { name: 'stream', title: 'Stream', - description: 'Stream', + description: 'Enable real-time data processing for faster predictions.', controllerType: 'checkbox', controllerData: { checked: false, diff --git a/web/screens/Chat/Sidebar/index.tsx b/web/screens/Chat/Sidebar/index.tsx index dce4fdf07..14c2a67d6 100644 --- a/web/screens/Chat/Sidebar/index.tsx +++ b/web/screens/Chat/Sidebar/index.tsx @@ -19,7 +19,7 @@ import DropdownListSidebar, { import { useCreateNewThread } from '@/hooks/useCreateNewThread' import { getConfigurationsData } from '@/utils/componentSettings' -import { toSettingParams } from '@/utils/model_param' +import { toRuntimeParams, toSettingParams } from '@/utils/model_param' import EngineSetting from '../EngineSetting' import ModelSetting from '../ModelSetting' @@ -44,7 +44,9 @@ const Sidebar: React.FC = () => { const threadStates = useAtomValue(threadStatesAtom) const modelEngineParams = toSettingParams(activeModelParams) - const componentDataEngineSetting = getConfigurationsData(modelEngineParams) + const modelRuntimeParams = toRuntimeParams(activeModelParams) + const componentDataRuntimeSetting = getConfigurationsData(modelEngineParams) + const componentDataEngineSetting = getConfigurationsData(modelRuntimeParams) const onReviewInFinderClick = async (type: string) => { if (!activeThread) return @@ -224,34 +226,42 @@ const Sidebar: React.FC = () => { -
- -
- -
-
-
+ {componentDataRuntimeSetting.length !== 0 && ( +
+ +
+ +
+
+
+ )} -
- -
- {settingComponentBuilder(componentDataEngineSetting, true)} + {componentDataEngineSetting.length !== 0 && ( + <> +
+ +
+ {settingComponentBuilder( + componentDataEngineSetting, + true + )} +
+
- -
- -
- -
- +
+ +
+ +
+
- -
+ + )}