fix: clickable remote model (#2970)
This commit is contained in:
parent
8dbb8d6536
commit
f0f273bf07
@ -324,41 +324,92 @@ const ModelDropdown = ({
|
|||||||
<h6 className="mb-1 mt-3 px-3 font-medium text-[hsla(var(--text-secondary))]">
|
<h6 className="mb-1 mt-3 px-3 font-medium text-[hsla(var(--text-secondary))]">
|
||||||
Cortex
|
Cortex
|
||||||
</h6>
|
</h6>
|
||||||
<ul className="pb-2">
|
{searchText.length === 0 ? (
|
||||||
{featuredModel.map((model) => {
|
<ul className="pb-2">
|
||||||
const isDownloading = downloadingModels.some(
|
{featuredModel.map((model) => {
|
||||||
(md) => md.id === model.id
|
const isDownloading = downloadingModels.some(
|
||||||
)
|
(md) => md.id === model.id
|
||||||
return (
|
)
|
||||||
<li
|
return (
|
||||||
key={model.id}
|
<li
|
||||||
className="flex items-center justify-between gap-4 px-3 py-2 hover:bg-[hsla(var(--dropdown-menu-hover-bg))]"
|
key={model.id}
|
||||||
>
|
className="flex items-center justify-between gap-4 px-3 py-2 hover:bg-[hsla(var(--dropdown-menu-hover-bg))]"
|
||||||
<div className="flex items-center gap-2">
|
>
|
||||||
<p
|
<div className="flex items-center gap-2">
|
||||||
className="line-clamp-1 text-[hsla(var(--text-secondary))]"
|
<p
|
||||||
title={model.name}
|
className="line-clamp-1 text-[hsla(var(--text-secondary))]"
|
||||||
>
|
title={model.name}
|
||||||
{model.name}
|
>
|
||||||
</p>
|
{model.name}
|
||||||
<ModelLabel metadata={model.metadata} compact />
|
</p>
|
||||||
</div>
|
<ModelLabel
|
||||||
<div className="flex items-center gap-2 text-[hsla(var(--text-tertiary))]">
|
metadata={model.metadata}
|
||||||
<span className="font-medium">
|
compact
|
||||||
{toGibibytes(model.metadata.size)}
|
|
||||||
</span>
|
|
||||||
{!isDownloading && (
|
|
||||||
<DownloadCloudIcon
|
|
||||||
size={18}
|
|
||||||
className="cursor-pointer text-[hsla(var(--app-link))]"
|
|
||||||
onClick={() => downloadModel(model)}
|
|
||||||
/>
|
/>
|
||||||
)}
|
</div>
|
||||||
</div>
|
<div className="flex items-center gap-2 text-[hsla(var(--text-tertiary))]">
|
||||||
</li>
|
<span className="font-medium">
|
||||||
)
|
{toGibibytes(model.metadata.size)}
|
||||||
})}
|
</span>
|
||||||
</ul>
|
{!isDownloading && (
|
||||||
|
<DownloadCloudIcon
|
||||||
|
size={18}
|
||||||
|
className="cursor-pointer text-[hsla(var(--app-link))]"
|
||||||
|
onClick={() => downloadModel(model)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
) : (
|
||||||
|
<ul className="pb-2">
|
||||||
|
{configuredModels
|
||||||
|
.filter((x) => x.engine === InferenceEngine.nitro)
|
||||||
|
.filter((e) =>
|
||||||
|
e.name
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchText.toLowerCase().trim())
|
||||||
|
)
|
||||||
|
.map((model) => {
|
||||||
|
const isDownloading = downloadingModels.some(
|
||||||
|
(md) => md.id === model.id
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
<li
|
||||||
|
key={model.id}
|
||||||
|
className="flex items-center justify-between gap-4 px-3 py-2 hover:bg-[hsla(var(--dropdown-menu-hover-bg))]"
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<p
|
||||||
|
className="line-clamp-1 text-[hsla(var(--text-secondary))]"
|
||||||
|
title={model.name}
|
||||||
|
>
|
||||||
|
{model.name}
|
||||||
|
</p>
|
||||||
|
<ModelLabel
|
||||||
|
metadata={model.metadata}
|
||||||
|
compact
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2 text-[hsla(var(--text-tertiary))]">
|
||||||
|
<span className="font-medium">
|
||||||
|
{toGibibytes(model.metadata.size)}
|
||||||
|
</span>
|
||||||
|
{!isDownloading && (
|
||||||
|
<DownloadCloudIcon
|
||||||
|
size={18}
|
||||||
|
className="cursor-pointer text-[hsla(var(--app-link))]"
|
||||||
|
onClick={() => downloadModel(model)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@ -397,12 +448,15 @@ const ModelDropdown = ({
|
|||||||
InferenceEngine.nitro_tensorrt_llm &&
|
InferenceEngine.nitro_tensorrt_llm &&
|
||||||
'cursor-default text-[hsla(var(--text-tertiary))]'
|
'cursor-default text-[hsla(var(--text-tertiary))]'
|
||||||
)}
|
)}
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
apiKey ||
|
if (
|
||||||
(model.engine ===
|
apiKey ||
|
||||||
InferenceEngine.nitro_tensorrt_llm &&
|
model.engine ===
|
||||||
onClickModelItem(model.id))
|
InferenceEngine.nitro_tensorrt_llm
|
||||||
}
|
) {
|
||||||
|
onClickModelItem(model.id)
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className="flex flex-shrink-0 gap-x-2">
|
<div className="flex flex-shrink-0 gap-x-2">
|
||||||
{engineHasLogo.map((x) => {
|
{engineHasLogo.map((x) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user