From 49d5703ac3817a27e994131f40b37f95d247bcc7 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Thu, 4 Jan 2024 01:10:01 +0700 Subject: [PATCH] bring back tooltip each params setting --- web/containers/Checkbox/index.tsx | 30 +++++++++- web/containers/ModelConfigInput/index.tsx | 30 +++++++++- web/containers/Slider/index.tsx | 55 +++++++++++++++++-- web/helpers/atoms/Thread.atom.ts | 2 + web/hooks/useSendChatMessage.ts | 8 ++- .../ModelSetting/settingComponentBuilder.tsx | 4 ++ web/screens/Chat/Sidebar/index.tsx | 6 +- web/screens/Chat/index.tsx | 29 ++++++++-- 8 files changed, 146 insertions(+), 18 deletions(-) diff --git a/web/containers/Checkbox/index.tsx b/web/containers/Checkbox/index.tsx index 4c124021e..12eed7199 100644 --- a/web/containers/Checkbox/index.tsx +++ b/web/containers/Checkbox/index.tsx @@ -1,8 +1,16 @@ import React from 'react' -import { Switch } from '@janhq/uikit' +import { + Switch, + Tooltip, + TooltipArrow, + TooltipContent, + TooltipPortal, + TooltipTrigger, +} from '@janhq/uikit' import { useAtomValue } from 'jotai' +import { InfoIcon } from 'lucide-react' import useUpdateModelParameters from '@/hooks/useUpdateModelParameters' @@ -11,10 +19,11 @@ import { getActiveThreadIdAtom } from '@/helpers/atoms/Thread.atom' type Props = { name: string title: string + description: string checked: boolean } -const Checkbox: React.FC = ({ name, title, checked }) => { +const Checkbox: React.FC = ({ name, title, checked, description }) => { const { updateModelParameter } = useUpdateModelParameters() const threadId = useAtomValue(getActiveThreadIdAtom) @@ -25,7 +34,22 @@ const Checkbox: React.FC = ({ name, title, checked }) => { return (
-

{title}

+
+

+ {title} +

+ + + + + + + {description} + + + + +
) diff --git a/web/containers/ModelConfigInput/index.tsx b/web/containers/ModelConfigInput/index.tsx index caa4f7fa3..ac66011bc 100644 --- a/web/containers/ModelConfigInput/index.tsx +++ b/web/containers/ModelConfigInput/index.tsx @@ -1,7 +1,16 @@ -import { Textarea } from '@janhq/uikit' +import { + Textarea, + Tooltip, + TooltipArrow, + TooltipContent, + TooltipPortal, + TooltipTrigger, +} from '@janhq/uikit' import { useAtomValue } from 'jotai' +import { InfoIcon } from 'lucide-react' + import useUpdateModelParameters from '@/hooks/useUpdateModelParameters' import { getActiveThreadIdAtom } from '@/helpers/atoms/Thread.atom' @@ -9,6 +18,7 @@ import { getActiveThreadIdAtom } from '@/helpers/atoms/Thread.atom' type Props = { title: string name: string + description: string placeholder: string value: string } @@ -17,6 +27,7 @@ const ModelConfigInput: React.FC = ({ title, name, value, + description, placeholder, }) => { const { updateModelParameter } = useUpdateModelParameters() @@ -30,7 +41,22 @@ const ModelConfigInput: React.FC = ({ return (
-

{title}

+
+

+ {title} +

+ + + + + + + {description} + + + + +