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.

fix: restore the emulated fallback and the arm64 iteration loop

Minh141120f5ef3bf519b2
diff --git a/.github/workflows/jan-tauri-build-nightly.yaml b/.github/workflows/jan-tauri-build-nightly.yaml
index ae724b212..d78a71903 100644
--- a/.github/workflows/jan-tauri-build-nightly.yaml
+++ b/.github/workflows/jan-tauri-build-nightly.yaml
@@ -25,6 +25,7 @@ on:
- '.github/workflows/template-get-update-version.yml'
- '.github/workflows/template-tauri-build-macos.yml'
- '.github/workflows/template-tauri-build-windows-x64.yml'
+ - '.github/workflows/template-tauri-build-windows-arm64.yml'
- '.github/workflows/template-tauri-build-linux-x64.yml'
- '.github/workflows/template-noti-discord-and-update-url-readme.yml'
- 'src-tauri/**'
@@ -138,9 +139,15 @@ jobs:
build-macos,
]
runs-on: ubuntu-22.04
- # build-windows-arm64 is in `needs` for its outputs, not as a gate: while
- # ARM64 is being stabilised a failed leg must not withhold the manifest
- # from x64, linux and macOS users.
+ # build-windows-arm64 does not gate *success*: while ARM64 is being
+ # stabilised, a failed leg still publishes a manifest for x64, linux and
+ # macOS rather than withholding it.
+ #
+ # It does still gate *scheduling* -- `needs` waits for the job to reach a
+ # terminal state whatever `if` says -- so a hung ARM build can delay the
+ # manifest by up to its 180-minute timeout. Accepted for now: the fix is a
+ # follow-up job that patches the key in after publishing, and that is only
+ # worth its second S3 sync once ARM64 runs on every nightly.
#
# Every other dependency is then re-asserted by hand, because a status
# function anywhere in `if` drops the implicit success() gate for the whole
diff --git a/.github/workflows/template-tauri-build-windows-arm64.yml b/.github/workflows/template-tauri-build-windows-arm64.yml
index d63616d6a..c21b5bebe 100644
--- a/.github/workflows/template-tauri-build-windows-arm64.yml
+++ b/.github/workflows/template-tauri-build-windows-arm64.yml
@@ -116,11 +116,18 @@ on:
the vulkan feature -- and the SDK requirement -- to any vendor build
whether or not the variant named it. Set to 1 with cuda13-vulkan.
+ # Pre-merge hook: workflow_dispatch is not offered until the file is on the
+ # default branch, so until this merges a push is the only way to exercise it.
+ # Drop this once it lands there.
+ push:
+ branches: ['feat/windows-arm64']
+
env:
- CHANNEL: ${{ inputs.channel }}
- NEW_VERSION: ${{ inputs.new_version }}
- JAN_ENGINE_VARIANT: ${{ inputs.engine_variant }}
- JAN_ENGINE_VULKAN_FALLBACK: ${{ inputs.vulkan_fallback }}
+ # `||` defaults because a push carries no inputs at all.
+ CHANNEL: ${{ inputs.channel || 'nightly' }}
+ NEW_VERSION: ${{ inputs.new_version || '0.0.0' }}
+ JAN_ENGINE_VARIANT: ${{ inputs.engine_variant || 'cuda13' }}
+ JAN_ENGINE_VULKAN_FALLBACK: ${{ inputs.vulkan_fallback || '0' }}
CUDA_SHORT: '13.4'
# Redistributable archives, as upstream llama.cpp provisions this same
# toolkit (.github/actions/windows-setup-cuda). The 3.8 GB installer spends
diff --git a/scripts/install-jan-agent.ps1 b/scripts/install-jan-agent.ps1
index 78cd498f0..76486a18c 100644
--- a/scripts/install-jan-agent.ps1
+++ b/scripts/install-jan-agent.ps1
@@ -36,7 +36,12 @@ $BinaryName = 'jan.exe'
# ARCHITEW6432 is what an emulated process sees; PROCESSOR_ARCHITECTURE alone
# would report AMD64 for an x64 PowerShell on an ARM64 machine.
$NativeArch = if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE }
-$PlatformKey = if ($NativeArch -eq 'ARM64') { 'windows-aarch64' } else { 'windows-x86_64' }
+# Native first, then x86_64 under emulation. ARM64 Windows runs the x64 build
+# fine, and it is all that any version predating ARM64 -- or any nightly whose
+# ARM leg failed -- has to offer. Hard-failing there would be a downgrade from
+# the emulated install these users already had.
+$PlatformKeys = if ($NativeArch -eq 'ARM64') { @('windows-aarch64', 'windows-x86_64') }
+ else { @('windows-x86_64') }
if (-not $Dir) {
if ($env:JAN_INSTALL_DIR) {
@@ -130,7 +135,16 @@ function Install-Published {
$resolved = $Version
if ($resolved) {
- $url = "$base/jan-agent-$PlatformKey-$resolved.zip"
+ foreach ($k in $PlatformKeys) {
+ $candidate = "$base/jan-agent-$k-$resolved.zip"
+ try {
+ Invoke-WebRequest -Uri $candidate -Method Head -UseBasicParsing | Out-Null
+ $url = $candidate
+ if ($k -ne $PlatformKeys[0]) { Write-Warning "no $($PlatformKeys[0]) build of $resolved; using $k under emulation" }
+ break
+ } catch { }
+ }
+ if (-not $url) { throw "no $Channel build of $resolved for $($PlatformKeys -join ' or ')" }
} else {
Write-Host "resolving the latest $Channel build"
try {
@@ -139,9 +153,17 @@ function Install-Published {
throw "cannot fetch $base/manifest.json : $($_.Exception.Message)"
}
$resolved = $manifest.version
- $entry = $manifest.platforms.$PlatformKey
- if (-not $entry -or -not $entry.url) {
- throw "the $Channel manifest has no build for $PlatformKey"
+ $entry = $null
+ foreach ($k in $PlatformKeys) {
+ $candidate = $manifest.platforms.$k
+ if ($candidate -and $candidate.url) {
+ $entry = $candidate
+ if ($k -ne $PlatformKeys[0]) { Write-Warning "no native $($PlatformKeys[0]) build published; using $k under emulation" }
+ break
+ }
+ }
+ if (-not $entry) {
+ throw "the $Channel manifest has no build for $($PlatformKeys -join ' or ')"
}
$url = $entry.url
if ($entry.PSObject.Properties.Name -contains 'sha256') { $expected = $entry.sha256 }