Akarshan Biswas 432c942330
fix: Prevent race condition with auto-unload during rapid model loading (#5947)
This commit addresses a race condition where, with "Auto-Unload Old Models" enabled, rapidly attempting to load multiple models could result in more than one model being loaded simultaneously.

Previously, the unloading logic did not account for models that were still in the process of loading when a new load operation was initiated. This allowed new models to start loading before the previous ones had fully completed their unload cycle.

To resolve this:
- A `loadingModels` map has been introduced to track promises for models currently in the loading state.
- The `load` method now checks if a model is already being loaded and, if so, returns the existing promise, preventing duplicate load operations for the same model.
- The `performLoad` method (which encapsulates the actual loading logic) now ensures that when `autoUnload` is active, it waits for any *other* models that are concurrently loading to finish before proceeding to unload all currently loaded models. This guarantees that the auto-unload mechanism properly unloads all models, including those initiated in quick succession, thereby preventing the race condition.

This fixes the issue where clicking the start button very fast on multiple models would bypass the auto-unload functionality.
2025-07-28 12:59:48 +05:30
2025-07-20 15:20:53 +07:00
2025-07-10 21:14:21 +07:00
2025-03-18 13:06:17 +07:00
2023-10-30 23:20:10 +07:00
2025-07-18 15:22:31 +07:00
2025-03-18 13:06:17 +07:00
2023-12-29 11:30:16 +07:00
2024-10-28 23:09:25 +07:00
2025-07-15 22:29:28 +07:00

Jan - Local AI Assistant

Jan banner

GitHub commit activity Github Last Commit Github Contributors GitHub closed issues Discord

Getting Started - Docs - Changelog - Bug reports - Discord

Jan is a ChatGPT-alternative that runs 100% offline on your device. Our goal is to make it easy for a layperson to download and run LLMs and use AI with full control and privacy.

⚠️ Jan is in active development.

Installation

Because clicking a button is still the easiest way to get started:

Platform Stable Beta Nightly
Windows jan.exe jan.exe jan.exe
macOS jan.dmg jan.dmg jan.dmg
Linux (deb) jan.deb jan.deb jan.deb
Linux (AppImage) jan.AppImage jan.AppImage jan.AppImage

Download from jan.ai or GitHub Releases.

Demo

Features

  • Local AI Models: Download and run LLMs (Llama, Gemma, Qwen, etc.) from HuggingFace
  • Cloud Integration: Connect to OpenAI, Anthropic, Mistral, Groq, and others
  • Custom Assistants: Create specialized AI assistants for your tasks
  • OpenAI-Compatible API: Local server at localhost:1337 for other applications
  • Model Context Protocol: MCP integration for enhanced capabilities
  • Privacy First: Everything runs locally when you want it to

Build from Source

For those who enjoy the scenic route:

Prerequisites

  • Node.js ≥ 20.0.0
  • Yarn ≥ 1.22.0
  • Make ≥ 3.81
  • Rust (for Tauri)

Run with Make

git clone https://github.com/menloresearch/jan
cd jan
make dev

This handles everything: installs dependencies, builds core components, and launches the app.

Available make targets:

  • make dev - Full development setup and launch
  • make build - Production build
  • make test - Run tests and linting
  • make clean - Delete everything and start fresh

Run with Mise (easier)

You can also run with mise, which is a bit easier as it ensures Node.js, Rust, and other dependency versions are automatically managed:

git clone https://github.com/menloresearch/jan
cd jan

# Install mise (if not already installed)
curl https://mise.run | sh

# Install tools and start development
mise install    # installs Node.js, Rust, and other tools
mise dev        # runs the full development setup

Available mise commands:

  • mise dev - Full development setup and launch
  • mise build - Production build
  • mise test - Run tests and linting
  • mise clean - Delete everything and start fresh
  • mise tasks - List all available tasks

Manual Commands

yarn install
yarn build:core
yarn build:extensions
yarn dev

System Requirements

Minimum specs for a decent experience:

  • macOS: 13.6+ (8GB RAM for 3B models, 16GB for 7B, 32GB for 13B)
  • Windows: 10+ with GPU support for NVIDIA/AMD/Intel Arc
  • Linux: Most distributions work, GPU acceleration available

For detailed compatibility, check our installation guides.

Troubleshooting

When things go sideways (they will):

  1. Check our troubleshooting docs
  2. Copy your error logs and system specs
  3. Ask for help in our Discord #🆘|jan-help channel

We keep logs for 24 hours, so don't procrastinate on reporting issues.

Contributing

Contributions welcome. See CONTRIBUTING.md for the full spiel.

Contact

Trust & Safety

Friendly reminder: We're not trying to scam you.

  • We won't ask for personal information
  • Jan is completely free (no premium version exists)
  • We don't have a cryptocurrency or ICO
  • We're bootstrapped and not seeking your investment (yet)

License

Apache 2.0 - Because sharing is caring.

Acknowledgements

Built on the shoulders of giants:

Description
Languages
TypeScript 54.9%
JavaScript 34.1%
Rust 8.6%
Python 1.5%
Shell 0.4%
Other 0.5%