feat: show model id on local api serve page (#3926)
This commit is contained in:
parent
b0087fca49
commit
92f2df1e89
@ -1,8 +1,8 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
|
||||
import { Accordion, AccordionItem } from '@janhq/joi'
|
||||
import { Accordion, AccordionItem, Input, Tooltip } from '@janhq/joi'
|
||||
import { useAtomValue, useSetAtom } from 'jotai'
|
||||
import { AlertTriangleIcon, InfoIcon } from 'lucide-react'
|
||||
import { AlertTriangleIcon, CheckIcon, CopyIcon, InfoIcon } from 'lucide-react'
|
||||
|
||||
import EngineSetting from '@/containers/EngineSetting'
|
||||
import { modalTroubleShootingAtom } from '@/containers/ModalTroubleShoot'
|
||||
@ -12,6 +12,8 @@ import RightPanelContainer from '@/containers/RightPanelContainer'
|
||||
|
||||
import { loadModelErrorAtom } from '@/hooks/useActiveModel'
|
||||
|
||||
import { useClipboard } from '@/hooks/useClipboard'
|
||||
|
||||
import { getConfigurationsData } from '@/utils/componentSettings'
|
||||
|
||||
import {
|
||||
@ -29,6 +31,8 @@ const LocalServerRightPanel = () => {
|
||||
|
||||
const selectedModel = useAtomValue(selectedModelAtom)
|
||||
|
||||
const clipboard = useClipboard({ timeout: 1000 })
|
||||
|
||||
const [currentModelSettingParams, setCurrentModelSettingParams] = useState(
|
||||
extractModelLoadParams(selectedModel?.settings)
|
||||
)
|
||||
@ -92,6 +96,35 @@ const LocalServerRightPanel = () => {
|
||||
|
||||
<ModelDropdown strictedThread={false} disabled={serverEnabled} />
|
||||
|
||||
<div className="mt-2">
|
||||
<Input
|
||||
value={selectedModel?.id || ''}
|
||||
className="cursor-pointer"
|
||||
readOnly
|
||||
suffixIcon={
|
||||
clipboard.copied ? (
|
||||
<CheckIcon
|
||||
size={14}
|
||||
className="text-[hsla(var(--success-bg))]"
|
||||
/>
|
||||
) : (
|
||||
<Tooltip
|
||||
trigger={
|
||||
<CopyIcon
|
||||
size={14}
|
||||
className="text-[hsla(var(--text-secondary))]"
|
||||
onClick={() => {
|
||||
clipboard.copy(selectedModel?.id)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
content="Copy Model ID"
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{loadModelError && serverEnabled && (
|
||||
<div className="mt-3 flex space-x-2">
|
||||
<AlertTriangleIcon
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user