/* eslint-disable @typescript-eslint/no-explicit-any */ import React, { useContext } from 'react' import { Input, Textarea, Switch, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipTrigger, } from '@janhq/uikit' import { atom, useAtomValue } from 'jotai' import { InfoIcon } from 'lucide-react' import { twMerge } from 'tailwind-merge' import LogoMark from '@/containers/Brand/Logo/Mark' import CardSidebar from '@/containers/CardSidebar' import DropdownListSidebar, { selectedModelAtom, } from '@/containers/DropdownListSidebar' import { FeatureToggleContext } from '@/context/FeatureToggle' import { useCreateNewThread } from '@/hooks/useCreateNewThread' import { getConfigurationsData } from '@/utils/componentSettings' import { toRuntimeParams, toSettingParams } from '@/utils/modelParam' import AssistantSetting from '../AssistantSetting' import EngineSetting from '../EngineSetting' import ModelSetting from '../ModelSetting' import SettingComponentBuilder from '../ModelSetting/SettingComponent' import { activeThreadAtom, getActiveThreadModelParamsAtom, } from '@/helpers/atoms/Thread.atom' export const showRightSideBarAtom = atom(true) const Sidebar: React.FC = () => { const showing = useAtomValue(showRightSideBarAtom) const activeThread = useAtomValue(activeThreadAtom) const activeModelParams = useAtomValue(getActiveThreadModelParamsAtom) const selectedModel = useAtomValue(selectedModelAtom) const { updateThreadMetadata } = useCreateNewThread() const { experimentalFeature } = useContext(FeatureToggleContext) const modelEngineParams = toSettingParams(activeModelParams) const modelRuntimeParams = toRuntimeParams(activeModelParams) const componentDataAssistantSetting = getConfigurationsData( (activeThread?.assistants[0]?.tools && activeThread?.assistants[0]?.tools[0]?.settings) ?? {} ) const componentDataEngineSetting = getConfigurationsData( modelEngineParams, selectedModel ) const componentDataRuntimeSetting = getConfigurationsData( modelRuntimeParams, selectedModel ) return (
{ if (activeThread) updateThreadMetadata({ ...activeThread, title: e.target.value || '', }) }} />
{activeThread?.id || '-'}
{activeThread?.assistants[0].assistant_name ?? '-'}