diff --git a/docs/src/components/Download/CardDownload.tsx b/docs/src/components/Download/CardDownload.tsx index d8730593c..82d8f6c8b 100644 --- a/docs/src/components/Download/CardDownload.tsx +++ b/docs/src/components/Download/CardDownload.tsx @@ -3,6 +3,7 @@ import { IconType } from 'react-icons/lib' import { FaWindows, FaApple, FaLinux } from 'react-icons/fa' import { twMerge } from 'tailwind-merge' import { DownloadIcon } from 'lucide-react' +import { formatFileSize } from '@/utils/format' type Props = { lastRelease: any @@ -14,6 +15,7 @@ type SystemType = { logo: IconType fileFormat: string href?: string + size?: string } const systemsTemplate: SystemType[] = [ @@ -84,9 +86,16 @@ export default function CardDownload({ lastRelease }: Props) { const downloadUrl = system.fileFormat .replace('{appname}', appname) .replace('{tag}', tag) + + // Find the corresponding asset to get the file size + const asset = lastRelease.assets.find( + (asset: any) => asset.name === downloadUrl + ) + return { ...system, href: `https://github.com/menloresearch/jan/releases/download/${lastRelease.tag_name}/${downloadUrl}`, + size: asset ? formatFileSize(asset.size) : undefined, } }) @@ -118,6 +127,11 @@ export default function CardDownload({ lastRelease }: Props) { > {system.label} + {system.size && ( +
+ {system.size} +
+ )} ))} diff --git a/docs/src/components/DropdownDownload/index.tsx b/docs/src/components/DropdownDownload/index.tsx index 5eb66e151..40b9220a0 100644 --- a/docs/src/components/DropdownDownload/index.tsx +++ b/docs/src/components/DropdownDownload/index.tsx @@ -4,6 +4,7 @@ import { IconType } from 'react-icons/lib' import { IoChevronDownOutline } from 'react-icons/io5' import { useClickOutside } from '@/hooks/useClickOutside' import { twMerge } from 'tailwind-merge' +import { formatFileSize } from '@/utils/format' type Props = { lastRelease: any @@ -14,6 +15,7 @@ type SystemType = { logo: IconType fileFormat: string href?: string + size?: string } type GpuInfo = { @@ -130,6 +132,7 @@ const DropdownDownload = ({ lastRelease }: Props) => { const updateDownloadLinks = async () => { try { const firstAssetName = await lastRelease.assets[0]?.name + const appname = extractAppName(firstAssetName) if (!appname) { console.error( @@ -147,9 +150,16 @@ const DropdownDownload = ({ lastRelease }: Props) => { const downloadUrl = system.fileFormat .replace('{appname}', appname) .replace('{tag}', tag) + + // Find the corresponding asset to get the file size + const asset = lastRelease.assets.find( + (asset: any) => asset.name === downloadUrl + ) + return { ...system, href: `https://github.com/menloresearch/jan/releases/download/${lastRelease.tag_name}/${downloadUrl}`, + size: asset ? formatFileSize(asset.size) : undefined, } }) setSystems(updatedSystems) @@ -176,10 +186,15 @@ const DropdownDownload = ({ lastRelease }: Props) => {
- {defaultSystem.name} + {defaultSystem.name} + {defaultSystem.size && ( + + ({defaultSystem.size}) + + )} {open && (
{systems.map((system) => (
setOpen(false)} > - - {system.name} +
+ + + {system.name} + +
+ {system.size && ( + + {system.size} + + )}
))} diff --git a/docs/src/components/Home/Feature/index.tsx b/docs/src/components/Home/Feature/index.tsx index 38c7c8fad..532b96e7d 100644 --- a/docs/src/components/Home/Feature/index.tsx +++ b/docs/src/components/Home/Feature/index.tsx @@ -44,7 +44,7 @@ const features = [ { title: 'Chat with your files', experimantal: true, - description: `Set up and run your own OpenAI-compatible API server using local models with just one click.`, + description: `Talk to PDFs, notes, and other documents directly to get summaries, answers, or insights.`, image: { light: '/assets/images/homepage/features05.png', dark: '/assets/images/homepage/features05dark.png', diff --git a/docs/src/utils/format.ts b/docs/src/utils/format.ts index 1ce858d59..a0a09e1a8 100644 --- a/docs/src/utils/format.ts +++ b/docs/src/utils/format.ts @@ -1,8 +1,22 @@ export function formatCompactNumber(count: number) { - const formatter = Intl.NumberFormat('en', { notation: 'compact', maximumFractionDigits: 1 }) + const formatter = Intl.NumberFormat('en', { + notation: 'compact', + maximumFractionDigits: 1, + }) return formatter.format(count) } +export function formatFileSize(bytes: number): string { + if (!bytes) return '0 B' + + const sizes = ['B', 'KB', 'MB', 'GB', 'TB'] + const i = Math.floor(Math.log(bytes) / Math.log(1024)) + + if (i === 0) return `${bytes} ${sizes[i]}` + + return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${sizes[i]}` +} + export const totalDownload = (release: []) => { if (release instanceof Array) { const count = release