'use client' import React from 'react' import { Button, Switch, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipTrigger, Select, SelectContent, SelectItem, Input, SelectTrigger, SelectValue, } from '@janhq/uikit' import { useAtom, useAtomValue } from 'jotai' import { Paintbrush, CodeIcon } from 'lucide-react' import { ExternalLinkIcon, InfoIcon } from 'lucide-react' import { twMerge } from 'tailwind-merge' import { twMerge } from 'tailwind-merge' import CardSidebar from '@/containers/CardSidebar' import DropdownListSidebar, { selectedModelAtom, } from '@/containers/DropdownListSidebar' import DropdownListSidebar from '@/containers/DropdownListSidebar' import { useActiveModel } from '@/hooks/useActiveModel' import { useServerLog } from '@/hooks/useServerLog' import { getConfigurationsData } from '@/utils/componentSettings' import { toRuntimeParams, toSettingParams } from '@/utils/modelParam' import EngineSetting from '../Chat/EngineSetting' import ModelSetting from '../Chat/ModelSetting' import settingComponentBuilder from '../Chat/ModelSetting/settingComponentBuilder' import { showRightSideBarAtom } from '../Chat/Sidebar' import { showRightSideBarAtom } from '../Chat/Sidebar' import Logs from './Logs' import { serverEnabledAtom } from '@/helpers/atoms/LocalServer.atom' import { getActiveThreadModelParamsAtom } from '@/helpers/atoms/Thread.atom' const LocalServerScreen = () => { const [serverEnabled, setServerEnabled] = useAtom(serverEnabledAtom) const showing = useAtomValue(showRightSideBarAtom) const activeModelParams = useAtomValue(getActiveThreadModelParamsAtom) const modelEngineParams = toSettingParams(activeModelParams) const modelRuntimeParams = toRuntimeParams(activeModelParams) const componentDataEngineSetting = getConfigurationsData(modelEngineParams) const componentDataRuntimeSetting = getConfigurationsData(modelRuntimeParams) const { openServerLog, clearServerLog } = useServerLog() const { activeModel, startModel } = useActiveModel() const [selectedModel] = useAtom(selectedModelAtom) return (
Start an OpenAI-compatible local HTTP server.