Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

docs(website): offer the Windows ARM64 installer (#9194)

James Dam571d00eedf16
diff --git a/docs/src/components/Download/CardDownload.tsx b/docs/src/components/Download/CardDownload.tsx
index c2a3891fa..7d0df206b 100644
--- a/docs/src/components/Download/CardDownload.tsx
+++ b/docs/src/components/Download/CardDownload.tsx
@@ -26,11 +26,17 @@ const systemsTemplate: SystemType[] = [
fileFormat: 'Jan_{tag}_universal.dmg',
},
{
- name: 'Windows',
- label: 'Standard (64-bit)',
+ name: 'Windows (x64)',
+ label: 'x64',
logo: FaWindows,
fileFormat: 'Jan_{tag}_x64-setup.exe',
},
+ {
+ name: 'Windows (ARM64)',
+ label: 'ARM64',
+ logo: FaWindows,
+ fileFormat: 'Jan_{tag}_arm64-setup.exe',
+ },
{
name: 'Linux (Flatpak)',
label: 'Flatpak',
diff --git a/docs/src/components/DropdownDownload/index.tsx b/docs/src/components/DropdownDownload/index.tsx
index 00f39acbc..b9f696e9a 100644
--- a/docs/src/components/DropdownDownload/index.tsx
+++ b/docs/src/components/DropdownDownload/index.tsx
@@ -5,6 +5,7 @@ import { IoChevronDownOutline } from 'react-icons/io5'
import { useClickOutside } from '@/hooks/useClickOutside'
import { twMerge } from 'tailwind-merge'
import { formatFileSize } from '@/utils/format'
+import { isWindowsArm } from '@/utils/platform'
type Props = {
lastRelease: any
@@ -31,10 +32,15 @@ const systemsTemplate: SystemType[] = [
fileFormat: 'Jan_{tag}_universal.dmg',
},
{
- name: 'Download for Windows',
+ name: 'Download for Windows (x64)',
logo: FaWindows,
fileFormat: 'Jan_{tag}_x64-setup.exe',
},
+ {
+ name: 'Download for Windows (ARM64)',
+ logo: FaWindows,
+ fileFormat: 'Jan_{tag}_arm64-setup.exe',
+ },
{
name: 'Download for Linux (Flatpak)',
logo: FaLinux,
@@ -70,7 +76,7 @@ const DropdownDownload = ({ lastRelease }: Props) => {
setDefaultSystem(systems[1])
} else if (userAgent.includes('Linux')) {
// linux user - prefer Flatpak (Flathub)
- setDefaultSystem(systems[2])
+ setDefaultSystem(systems[3])
} else if (userAgent.includes('Mac OS')) {
setDefaultSystem(systems[0])
} else {
@@ -129,6 +135,7 @@ const DropdownDownload = ({ lastRelease }: Props) => {
}
useEffect(() => {
+ let cancelled = false
const updateDownloadLinks = async () => {
try {
const tag = lastRelease.tag_name.startsWith('v')
@@ -154,6 +161,18 @@ const DropdownDownload = ({ lastRelease }: Props) => {
})
setSystems(updatedSystems)
changeDefaultSystem(updatedSystems)
+
+ // The user agent can't tell Windows on ARM apart, so upgrade the
+ // Windows default to ARM64 only once Client Hints confirm it, and only
+ // when this release ships the ARM64 installer (else x64 still works).
+ const armSystem = updatedSystems[2]
+ const hasArmAsset = lastRelease.assets.some(
+ (asset: any) =>
+ asset.name === armSystem.fileFormat.replace('{tag}', tag)
+ )
+ if (hasArmAsset && (await isWindowsArm()) && !cancelled) {
+ setDefaultSystem(armSystem)
+ }
} catch (error) {
console.error('Failed to update download links:', error)
}
@@ -163,6 +182,9 @@ const DropdownDownload = ({ lastRelease }: Props) => {
detectGPU()
}
updateDownloadLinks()
+ return () => {
+ cancelled = true
+ }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [gpuInfo])
diff --git a/docs/src/components/ui/dropdown-button.tsx b/docs/src/components/ui/dropdown-button.tsx
index 98adb3523..05cad8102 100644
--- a/docs/src/components/ui/dropdown-button.tsx
+++ b/docs/src/components/ui/dropdown-button.tsx
@@ -3,6 +3,7 @@ import { Button } from './button'
import { cn } from '@/lib/utils'
import { FaApple, FaWindows, FaLinux } from 'react-icons/fa'
import { formatFileSize } from '@/utils/format'
+import { isWindowsArm } from '@/utils/platform'
interface DownloadOption {
id: string
@@ -24,7 +25,14 @@ const downloadOptionsTemplate: DownloadOption[] = [
},
{
id: 'windows',
- name: 'Download for Windows',
+ name: 'Download for Windows (x64)',
+ icon: <FaWindows className="size-5" />,
+ size: '',
+ href: '#',
+ },
+ {
+ id: 'windows-arm64',
+ name: 'Download for Windows (ARM64)',
icon: <FaWindows className="size-5" />,
size: '',
href: '#',
@@ -55,6 +63,7 @@ const downloadOptionsTemplate: DownloadOption[] = [
const fileFormatMap: { [key: string]: string } = {
'mac': 'Jan_{tag}_universal.dmg',
'windows': 'Jan_{tag}_x64-setup.exe',
+ 'windows-arm64': 'Jan_{tag}_arm64-setup.exe',
'linux-appimage': 'Jan_{tag}_amd64.AppImage',
'linux-deb': 'Jan_{tag}_amd64.deb',
}
@@ -112,6 +121,7 @@ export function DropdownButton({
}, [])
React.useEffect(() => {
+ let cancelled = false
if (lastRelease) {
try {
const tag = lastRelease.tag_name.startsWith('v')
@@ -139,10 +149,28 @@ export function DropdownButton({
setDownloadOptions(updatedOptions)
changeDefaultSystem(updatedOptions)
+
+ // The user agent can't tell Windows on ARM apart, so upgrade the
+ // Windows default to ARM64 only once Client Hints confirm it, and only
+ // when this release ships the ARM64 installer (else x64 still works).
+ const armFile = fileFormatMap['windows-arm64'].replace('{tag}', tag)
+ const hasArmAsset = lastRelease.assets.some(
+ (asset: any) => asset.name === armFile
+ )
+ isWindowsArm().then((windowsArm) => {
+ const armOption = updatedOptions.find(
+ (opt) => opt.id === 'windows-arm64'
+ )
+ if (windowsArm && hasArmAsset && !cancelled && armOption)
+ setCurrentOption(armOption)
+ })
} catch (error) {
console.error('Failed to update download links:', error)
}
}
+ return () => {
+ cancelled = true
+ }
}, [lastRelease, changeDefaultSystem])
// Flatpak isn't a GitHub release asset (it's on Flathub), so its size can't
diff --git a/docs/src/hooks/useDownloadLink.ts b/docs/src/hooks/useDownloadLink.ts
index b9979f4c8..beb1e6600 100644
--- a/docs/src/hooks/useDownloadLink.ts
+++ b/docs/src/hooks/useDownloadLink.ts
@@ -2,17 +2,31 @@ import { useEffect, useState } from 'react'
import axios from 'axios'
+import { isWindowsArm } from '@/utils/platform'
+
// The releases page — used as the initial value and as the fallback when the
// latest-release lookup fails, so the button always works.
const RELEASES_PAGE = 'https://github.com/janhq/jan/releases/latest'
// Mirrors DropdownDownload's per-OS asset mapping: Mac gets the universal dmg,
-// Windows the x64 installer, Linux goes to Flathub (same default as the hero).
-const assetHref = (userAgent: string, tagName: string): string => {
+// Windows the x64 or ARM64 installer, Linux goes to Flathub (same default as
+// the hero).
+const assetHref = (
+ userAgent: string,
+ release: LatestRelease,
+ windowsArm: boolean
+): string => {
+ const tagName = release.tag_name
const version = tagName.startsWith('v') ? tagName.slice(1) : tagName
const base = `https://github.com/janhq/jan/releases/download/${tagName}`
if (userAgent.includes('Windows')) {
+ // Only point at the ARM64 installer when this release ships one; the x64
+ // build still runs on Windows on ARM under emulation.
+ const armFile = `Jan_${version}_arm64-setup.exe`
+ if (windowsArm && release.assets?.some((a) => a.name === armFile)) {
+ return `${base}/${armFile}`
+ }
return `${base}/Jan_${version}_x64-setup.exe`
}
if (userAgent.includes('Mac')) {
@@ -25,9 +39,11 @@ const assetHref = (userAgent: string, tagName: string): string => {
return `${base}/Jan_${version}_x64-setup.exe`
}
-// Cache the tag across mounts so navigating the site doesn't refetch the release
+type LatestRelease = { tag_name: string; assets?: { name: string }[] }
+
+// Cache the release across mounts so navigating the site doesn't refetch it
// (and keeps us well under GitHub's unauthenticated rate limit).
-let cachedTag: string | null = null
+let cachedRelease: LatestRelease | null = null
// Resolves the direct, OS-specific download link for the latest Jan release.
// Detects the OS in the browser and points straight at the matching asset,
@@ -38,23 +54,27 @@ export const useDownloadLink = (): string => {
useEffect(() => {
let cancelled = false
- const resolve = (tag: string) => {
- if (!cancelled) setHref(assetHref(navigator.userAgent, tag))
+ const resolve = async (release: LatestRelease) => {
+ const windowsArm = await isWindowsArm()
+ if (!cancelled)
+ setHref(assetHref(navigator.userAgent, release, windowsArm))
}
- if (cachedTag) {
- resolve(cachedTag)
- return
+ if (cachedRelease) {
+ resolve(cachedRelease)
+ return () => {
+ cancelled = true
+ }
}
axios
- .get<{ tag_name: string }>(
+ .get<LatestRelease>(
'https://api.github.com/repos/janhq/jan/releases/latest'
)
.then(({ data }) => {
if (data?.tag_name) {
- cachedTag = data.tag_name
- resolve(data.tag_name)
+ cachedRelease = data
+ resolve(data)
}
})
.catch(() => {
diff --git a/docs/src/pages/docs/desktop/install/windows.mdx b/docs/src/pages/docs/desktop/install/windows.mdx
index c2a54cefc..01b2317e5 100644
--- a/docs/src/pages/docs/desktop/install/windows.mdx
+++ b/docs/src/pages/docs/desktop/install/windows.mdx
@@ -40,7 +40,9 @@ Jan runs on Windows 10 and higher, supporting NVIDIA, AMD, and Intel Arc GPUs.
### Download
-<DownloadButton href="https://app.jan.ai/download/latest/win-x64">Download Jan for Windows</DownloadButton>
+<DownloadButton href="https://app.jan.ai/download/latest/win-x64">Download Jan for Windows (x64)</DownloadButton>
+
+On a Windows on ARM PC, get the **ARM64** installer from the [download page](/download) instead.
### Install
@@ -53,7 +55,7 @@ Jan runs on Windows 10 and higher, supporting NVIDIA, AMD, and Intel Arc GPUs.
## Compatibility
- **Operating System:** Windows 10 or higher
-- **CPU:** AVX2 support required — Intel Haswell (2013+), AMD Excavator (2015+)
+- **CPU:** x64 with AVX2 support — Intel Haswell (2013+), AMD Excavator (2015+) — or ARM64 (Windows on ARM)
- **Memory:** 8GB minimum (16GB recommended)
- **GPU:** 6GB VRAM minimum for NVIDIA, AMD, or Intel Arc GPUs
- **Storage:** 10GB free space minimum
diff --git a/docs/src/utils/platform.ts b/docs/src/utils/platform.ts
new file mode 100644
index 000000000..6d28d091e
--- /dev/null
+++ b/docs/src/utils/platform.ts
@@ -0,0 +1,26 @@
+// User-Agent Client Hints aren't in TypeScript's DOM lib yet, so type the one
+// call we make.
+type NavigatorWithUAData = Navigator & {
+ userAgentData?: {
+ getHighEntropyValues?: (
+ hints: string[]
+ ) => Promise<{ architecture?: string }>
+ }
+}
+
+// Windows on ARM reports the same user agent string as x64, so only Client
+// Hints (Chromium/Edge) can tell them apart. Resolves false everywhere else,
+// which keeps the x64 installer as the Windows default.
+export const isWindowsArm = async (): Promise<boolean> => {
+ if (typeof navigator === 'undefined') return false
+ if (!navigator.userAgent.includes('Windows')) return false
+
+ try {
+ const values = await (
+ navigator as NavigatorWithUAData
+ ).userAgentData?.getHighEntropyValues?.(['architecture'])
+ return values?.architecture === 'arm'
+ } catch {
+ return false
+ }
+}