Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update hub search result #3273

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 45 additions & 10 deletions web/screens/HubScreen2/components/HubScreenFilter/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import { Fragment } from 'react'

import Image from 'next/image'

import BlankState from '@/containers/BlankState'

import useModelHub from '@/hooks/useModelHub'
Expand Down Expand Up @@ -43,23 +47,54 @@ const HubScreenFilter: React.FC<Props> = ({ queryText }) => {
filteredHuggingFaceModels.length === 0 &&
filteredRemoteModels.length === 0

const isOnDevice =
filteredBuiltInModels.length > 0 || filteredHuggingFaceModels.length > 0

return (
<div className="h-full w-full overflow-x-hidden rounded-lg bg-[hsla(var(--app-bg))]">
{isResultEmpty ? (
<div className="py-6">
<BlankState title="No search results found" />
</div>
) : (
<div className="mx-auto flex h-full w-full max-w-[650px] flex-col gap-6 py-6">
{filteredBuiltInModels.map((hfModelEntry) => (
<BuiltInModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
{filteredHuggingFaceModels.map((hfModelEntry) => (
<HuggingFaceModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
{filteredRemoteModels.map((hfModelEntry) => (
<RemoteModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
<div className="mx-auto mt-6 flex h-full w-full max-w-[650px] flex-col gap-6 py-6">
{isOnDevice && (
<Fragment>
<div className="mt-4 flex items-center gap-2 first:mt-0">
<Image
width={24}
height={24}
src="icons/app_icon.svg"
alt="Built-In Models"
/>
<h1 className="text-lg font-semibold">On-Device Models</h1>
</div>
<div className="w-full">
{filteredBuiltInModels.map((hfModelEntry) => (
<BuiltInModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
{filteredHuggingFaceModels.map((hfModelEntry) => (
<HuggingFaceModelCard
key={hfModelEntry.id}
{...hfModelEntry}
/>
))}
</div>
</Fragment>
)}

{filteredRemoteModels.length > 0 && (
<Fragment>
<div className="mt-4 flex items-center gap-2 first:mt-0">
<h1 className="text-lg font-semibold">Cloud Models</h1>
</div>
<div className="w-full">
{filteredRemoteModels.map((hfModelEntry) => (
<RemoteModelCard key={hfModelEntry.id} {...hfModelEntry} />
))}
</div>
</Fragment>
)}
</div>
)}
</div>
Expand Down
8 changes: 7 additions & 1 deletion web/screens/HubScreen2/components/RemoteModelGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ const RemoteModelGroup: React.FC<Props> = ({ data, engine, onSeeAllClick }) => {
<Fragment>
<div className="mt-12 flex items-center gap-2 first:mt-0">
{engineLogo && (
<Image width={24} height={24} src={engineLogo} alt="Engine logo" />
<Image
width={24}
height={24}
src={engineLogo}
alt="Engine logo"
className="rounded-full"
/>
)}
<h1 className="text-lg font-semibold">{refinedTitle}</h1>

Expand Down
Loading