feat: allow user click badge cmd shortcut my model and update copy
This commit is contained in:
parent
82ffcd06f1
commit
e38e9c7e45
@ -1,15 +1,30 @@
|
|||||||
import { ReactNode } from 'react'
|
import { ReactNode } from 'react'
|
||||||
|
|
||||||
|
import { twMerge } from 'tailwind-merge'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
name?: string
|
name?: string
|
||||||
value: string | ReactNode
|
value: string | ReactNode
|
||||||
|
titleBold?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function SystemItem({ name, value }: Props) {
|
export default function SystemItem({ name, value, titleBold }: Props) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-x-1">
|
<div className="flex items-center gap-x-1 text-xs">
|
||||||
<p className="text-xs">{name}</p>
|
<p
|
||||||
<span className="text-xs font-bold">{value}</span>
|
className={twMerge(
|
||||||
|
titleBold ? 'font-semibold' : 'text-muted-foreground'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{name}
|
||||||
|
</p>
|
||||||
|
<span
|
||||||
|
className={twMerge(
|
||||||
|
titleBold ? 'text-muted-foreground' : 'font-semibold'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{value}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,17 +6,19 @@ import {
|
|||||||
TooltipContent,
|
TooltipContent,
|
||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from '@janhq/uikit'
|
} from '@janhq/uikit'
|
||||||
import { useAtomValue } from 'jotai'
|
import { useAtomValue, useSetAtom } from 'jotai'
|
||||||
|
|
||||||
import { FaGithub, FaDiscord } from 'react-icons/fa'
|
import { FaGithub, FaDiscord } from 'react-icons/fa'
|
||||||
|
|
||||||
import DownloadingState from '@/containers/Layout/BottomBar/DownloadingState'
|
import DownloadingState from '@/containers/Layout/BottomBar/DownloadingState'
|
||||||
|
|
||||||
import SystemItem from '@/containers/Layout/BottomBar/SystemItem'
|
import SystemItem from '@/containers/Layout/BottomBar/SystemItem'
|
||||||
|
import CommandListDownloadedModel from '@/containers/Layout/TopBar/CommandListDownloadedModel'
|
||||||
import ProgressBar from '@/containers/ProgressBar'
|
import ProgressBar from '@/containers/ProgressBar'
|
||||||
|
|
||||||
import { appDownloadProgress } from '@/containers/Providers/Jotai'
|
import { appDownloadProgress } from '@/containers/Providers/Jotai'
|
||||||
|
|
||||||
|
import { showSelectModelModalAtom } from '@/containers/Providers/KeyListener'
|
||||||
import ShortCut from '@/containers/Shortcut'
|
import ShortCut from '@/containers/Shortcut'
|
||||||
|
|
||||||
import { MainViewState } from '@/constants/screens'
|
import { MainViewState } from '@/constants/screens'
|
||||||
@ -48,6 +50,7 @@ const BottomBar = () => {
|
|||||||
const { downloadedModels } = useGetDownloadedModels()
|
const { downloadedModels } = useGetDownloadedModels()
|
||||||
const { setMainViewState } = useMainViewState()
|
const { setMainViewState } = useMainViewState()
|
||||||
const { downloadStates } = useDownloadState()
|
const { downloadStates } = useDownloadState()
|
||||||
|
const setShowSelectModelModal = useSetAtom(showSelectModelModalAtom)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="fixed bottom-0 left-16 z-20 flex h-12 w-[calc(100%-64px)] items-center justify-between border-t border-border bg-background/80 px-3">
|
<div className="fixed bottom-0 left-16 z-20 flex h-12 w-[calc(100%-64px)] items-center justify-between border-t border-border bg-background/80 px-3">
|
||||||
@ -58,24 +61,31 @@ const BottomBar = () => {
|
|||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Badge
|
||||||
|
themes="secondary"
|
||||||
|
className="cursor-pointer rounded-md border-none font-medium"
|
||||||
|
onClick={() => setShowSelectModelModal((show) => !show)}
|
||||||
|
>
|
||||||
|
My Models
|
||||||
|
<ShortCut menu="E" />
|
||||||
|
</Badge>
|
||||||
|
|
||||||
{stateModel.state === 'start' && stateModel.loading && (
|
{stateModel.state === 'start' && stateModel.loading && (
|
||||||
<SystemItem name="Starting:" value={stateModel.model || '-'} />
|
<SystemItem
|
||||||
|
titleBold
|
||||||
|
name="Starting"
|
||||||
|
value={stateModel.model || '-'}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{stateModel.state === 'stop' && stateModel.loading && (
|
{stateModel.state === 'stop' && stateModel.loading && (
|
||||||
<SystemItem name="Stopping:" value={stateModel.model || '-'} />
|
<SystemItem
|
||||||
|
titleBold
|
||||||
|
name="Stopping"
|
||||||
|
value={stateModel.model || '-'}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
{!stateModel.loading && downloadedModels.length !== 0 && (
|
{!stateModel.loading && downloadedModels.length !== 0 && (
|
||||||
<SystemItem
|
<SystemItem titleBold name={'Active model'} value={activeModel?.id} />
|
||||||
name={activeModel?.id ? 'Active model:' : ''}
|
|
||||||
value={
|
|
||||||
activeModel?.id || (
|
|
||||||
<Badge themes="outline" className="pl-1">
|
|
||||||
<ShortCut menu="E" />
|
|
||||||
to view models
|
|
||||||
</Badge>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
{downloadedModels.length === 0 &&
|
{downloadedModels.length === 0 &&
|
||||||
!stateModel.loading &&
|
!stateModel.loading &&
|
||||||
@ -91,13 +101,15 @@ const BottomBar = () => {
|
|||||||
|
|
||||||
<DownloadingState />
|
<DownloadingState />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-x-4">
|
<div className="flex items-center gap-x-3">
|
||||||
<div className="flex items-center gap-x-2">
|
<div className="flex items-center gap-x-2">
|
||||||
<SystemItem name="CPU:" value={`${cpu}%`} />
|
<SystemItem name="CPU:" value={`${cpu}%`} />
|
||||||
<SystemItem name="Mem:" value={`${ram}%`} />
|
<SystemItem name="Mem:" value={`${ram}%`} />
|
||||||
</div>
|
</div>
|
||||||
{/* VERSION is defined by webpack, please see next.config.js */}
|
{/* VERSION is defined by webpack, please see next.config.js */}
|
||||||
<span className="text-xs">Jan v{VERSION ?? ''}</span>
|
<span className="text-xs text-muted-foreground">
|
||||||
|
Jan v{VERSION ?? ''}
|
||||||
|
</span>
|
||||||
<div className="mt-1 flex items-center gap-x-2">
|
<div className="mt-1 flex items-center gap-x-2">
|
||||||
{menuLinks
|
{menuLinks
|
||||||
.filter((link) => !!link)
|
.filter((link) => !!link)
|
||||||
@ -123,6 +135,7 @@ const BottomBar = () => {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<CommandListDownloadedModel />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import {
|
|||||||
|
|
||||||
import { twMerge } from 'tailwind-merge'
|
import { twMerge } from 'tailwind-merge'
|
||||||
|
|
||||||
import CommandListDownloadedModel from '@/containers/Layout/TopBar/CommandListDownloadedModel'
|
|
||||||
import CommandSearch from '@/containers/Layout/TopBar/CommandSearch'
|
import CommandSearch from '@/containers/Layout/TopBar/CommandSearch'
|
||||||
|
|
||||||
import { MainViewState } from '@/constants/screens'
|
import { MainViewState } from '@/constants/screens'
|
||||||
@ -213,7 +212,6 @@ const TopBar = () => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<CommandSearch />
|
<CommandSearch />
|
||||||
<CommandListDownloadedModel />
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user