Add model right panel on api dashboard
This commit is contained in:
parent
167db02f04
commit
c570281e43
@ -19,8 +19,14 @@ interface Props {
|
|||||||
children: ReactNode
|
children: ReactNode
|
||||||
title: string
|
title: string
|
||||||
asChild?: boolean
|
asChild?: boolean
|
||||||
|
hideMoreVerticalAction?: boolean
|
||||||
}
|
}
|
||||||
export default function CardSidebar({ children, title, asChild }: Props) {
|
export default function CardSidebar({
|
||||||
|
children,
|
||||||
|
title,
|
||||||
|
asChild,
|
||||||
|
hideMoreVerticalAction,
|
||||||
|
}: Props) {
|
||||||
const [show, setShow] = useState(true)
|
const [show, setShow] = useState(true)
|
||||||
const [more, setMore] = useState(false)
|
const [more, setMore] = useState(false)
|
||||||
const [menu, setMenu] = useState<HTMLDivElement | null>(null)
|
const [menu, setMenu] = useState<HTMLDivElement | null>(null)
|
||||||
@ -52,7 +58,8 @@ export default function CardSidebar({ children, title, asChild }: Props) {
|
|||||||
>
|
>
|
||||||
<span className="font-bold">{title}</span>
|
<span className="font-bold">{title}</span>
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
{!asChild && (
|
{!asChild ||
|
||||||
|
(hideMoreVerticalAction && (
|
||||||
<div
|
<div
|
||||||
ref={setToggle}
|
ref={setToggle}
|
||||||
className="cursor-pointer rounded-lg bg-zinc-100 p-2 pr-0 dark:bg-zinc-900"
|
className="cursor-pointer rounded-lg bg-zinc-100 p-2 pr-0 dark:bg-zinc-900"
|
||||||
@ -60,7 +67,7 @@ export default function CardSidebar({ children, title, asChild }: Props) {
|
|||||||
>
|
>
|
||||||
<MoreVerticalIcon className="h-5 w-5" />
|
<MoreVerticalIcon className="h-5 w-5" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
))}
|
||||||
<button
|
<button
|
||||||
onClick={() => setShow(!show)}
|
onClick={() => setShow(!show)}
|
||||||
className="flex w-full flex-1 items-center space-x-2 rounded-lg bg-zinc-100 px-3 py-2 dark:bg-zinc-900"
|
className="flex w-full flex-1 items-center space-x-2 rounded-lg bg-zinc-100 px-3 py-2 dark:bg-zinc-900"
|
||||||
|
|||||||
@ -5,15 +5,29 @@ import { ExternalLinkIcon } from 'lucide-react'
|
|||||||
|
|
||||||
import { twMerge } from 'tailwind-merge'
|
import { twMerge } from 'tailwind-merge'
|
||||||
|
|
||||||
|
import CardSidebar from '@/containers/CardSidebar'
|
||||||
import DropdownListSidebar from '@/containers/DropdownListSidebar'
|
import DropdownListSidebar from '@/containers/DropdownListSidebar'
|
||||||
|
|
||||||
|
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 { serverEnabledAtom } from '@/helpers/atoms/LocalServer.atom'
|
import { serverEnabledAtom } from '@/helpers/atoms/LocalServer.atom'
|
||||||
|
import { getActiveThreadModelParamsAtom } from '@/helpers/atoms/Thread.atom'
|
||||||
|
|
||||||
const LocalServerScreen = () => {
|
const LocalServerScreen = () => {
|
||||||
const [serverEnabled, setServerEnabled] = useAtom(serverEnabledAtom)
|
const [serverEnabled, setServerEnabled] = useAtom(serverEnabledAtom)
|
||||||
const showing = useAtomValue(showRightSideBarAtom)
|
const showing = useAtomValue(showRightSideBarAtom)
|
||||||
|
const activeModelParams = useAtomValue(getActiveThreadModelParamsAtom)
|
||||||
|
|
||||||
|
const modelEngineParams = toSettingParams(activeModelParams)
|
||||||
|
const modelRuntimeParams = toRuntimeParams(activeModelParams)
|
||||||
|
const componentDataEngineSetting = getConfigurationsData(modelEngineParams)
|
||||||
|
const componentDataRuntimeSetting = getConfigurationsData(modelRuntimeParams)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full w-full">
|
<div className="flex h-full w-full">
|
||||||
@ -72,12 +86,45 @@ const LocalServerScreen = () => {
|
|||||||
: 'w-0 translate-x-full opacity-0'
|
: 'w-0 translate-x-full opacity-0'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<p>
|
<CardSidebar title="Model" hideMoreVerticalAction>
|
||||||
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Cumque earum
|
<div className="px-2">
|
||||||
numquam fugit quia quisquam id quos aspernatur unde voluptatem neque,
|
<div className="mt-4">
|
||||||
officiis doloribus, laborum totam ad deserunt corporis impedit beatae
|
<DropdownListSidebar />
|
||||||
vitae?
|
</div>
|
||||||
</p>
|
|
||||||
|
{componentDataRuntimeSetting.length !== 0 && (
|
||||||
|
<div className="mt-6">
|
||||||
|
<CardSidebar title="Inference Parameters" asChild>
|
||||||
|
<div className="px-2 py-4">
|
||||||
|
<ModelSetting />
|
||||||
|
</div>
|
||||||
|
</CardSidebar>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{componentDataEngineSetting.filter(
|
||||||
|
(x) => x.name === 'prompt_template'
|
||||||
|
).length !== 0 && (
|
||||||
|
<div className="mt-4">
|
||||||
|
<CardSidebar title="Model Parameters" asChild>
|
||||||
|
<div className="px-2 py-4">
|
||||||
|
{settingComponentBuilder(componentDataEngineSetting, true)}
|
||||||
|
</div>
|
||||||
|
</CardSidebar>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{componentDataEngineSetting.length !== 0 && (
|
||||||
|
<div className="my-4">
|
||||||
|
<CardSidebar title="Engine Parameters" asChild>
|
||||||
|
<div className="px-2 py-4">
|
||||||
|
<EngineSetting />
|
||||||
|
</div>
|
||||||
|
</CardSidebar>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</CardSidebar>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user