Skip to content
Merged
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
47 changes: 42 additions & 5 deletions web-app/src/routes/hub/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { useVirtualizer } from '@tanstack/react-virtual'
import { createFileRoute, useNavigate, useSearch } from '@tanstack/react-router'
import { route } from '@/constants/routes'
import { useModelSources } from '@/hooks/useModelSources'
import { cn } from '@/lib/utils'
import {

Check warning on line 7 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

2-7 lines are not covered with tests
useState,
useMemo,
useEffect,
Expand All @@ -12,39 +12,46 @@
useCallback,
useRef,
} from 'react'
import { Button } from '@/components/ui/button'
import { useModelProvider } from '@/hooks/useModelProvider'
import { Card, CardItem } from '@/containers/Card'
import { RenderMarkdown } from '@/containers/RenderMarkdown'
import { extractModelName, extractDescription } from '@/lib/models'
import {

Check warning on line 20 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

15-20 lines are not covered with tests
IconDownload,
IconFileCode,
IconEye,
IconSearch,
IconTool,
} from '@tabler/icons-react'
import { Switch } from '@/components/ui/switch'
import {

Check warning on line 28 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

27-28 lines are not covered with tests
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip'
import Joyride, { CallBackProps, STATUS } from 'react-joyride'
import { CustomTooltipJoyRide } from '@/containers/CustomeTooltipJoyRide'
import {

Check warning on line 36 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

34-36 lines are not covered with tests
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu'
import {

Check warning on line 42 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

42 line is not covered with tests
CatalogModel,
pullModel,
fetchHuggingFaceRepo,
convertHfRepoToCatalogModel,
} from '@/services/models'
import { useDownloadStore } from '@/hooks/useDownloadStore'
import { Progress } from '@/components/ui/progress'
import HeaderPage from '@/containers/HeaderPage'
import { Loader } from 'lucide-react'
import { useTranslation } from '@/i18n/react-i18next-compat'
import Fuse from 'fuse.js'
import { useGeneralSetting } from '@/hooks/useGeneralSetting'

Check warning on line 54 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

48-54 lines are not covered with tests

type ModelProps = {
model: CatalogModel
Expand All @@ -52,27 +59,27 @@
type SearchParams = {
repo: string
}
const defaultModelQuantizations = ['iq4_xs', 'q4_k_m']

Check warning on line 62 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

62 line is not covered with tests

export const Route = createFileRoute(route.hub.index as any)({
component: Hub,
validateSearch: (search: Record<string, unknown>): SearchParams => ({
repo: search.repo as SearchParams['repo'],
}),
})

Check warning on line 69 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

64-69 lines are not covered with tests

function Hub() {
const parentRef = useRef(null)
const { huggingfaceToken } = useGeneralSetting()

Check warning on line 73 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

71-73 lines are not covered with tests

const { t } = useTranslation()
const sortOptions = [
{ value: 'newest', name: t('hub:sortNewest') },
{ value: 'most-downloaded', name: t('hub:sortMostDownloaded') },
]
const searchOptions = useMemo(() => {
return {
includeScore: true,

Check warning on line 82 in web-app/src/routes/hub/index.tsx

View workflow job for this annotation

GitHub Actions / coverage-check

75-82 lines are not covered with tests
// Search in `author` and in `tags` array
keys: ['model_name', 'quants.model_id'],
}
Expand Down Expand Up @@ -661,11 +668,41 @@
</div>
{filteredModels[virtualItem.index].tools && (
<div className="flex items-center gap-1">
<IconTool
size={17}
className="text-main-view-fg/50"
title={t('hub:tools')}
/>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<div>
<IconTool
size={17}
className="text-main-view-fg/50"
/>
</div>
</TooltipTrigger>
<TooltipContent>
<p>{t('tools')}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
)}
{filteredModels[virtualItem.index].num_mmproj >
0 && (
<div className="flex items-center gap-1">
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<div>
<IconEye
size={17}
className="text-main-view-fg/50"
/>
</div>
</TooltipTrigger>
<TooltipContent>
<p>{t('vision')}</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
)}
{filteredModels[virtualItem.index].quants.length >
Expand Down
Loading