Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
feat(llamacpp): upgrade the engine to 0.4.1 (b10964) (#9026)
Akarshan Biswas36f98b3af5f8
diff --git a/extensions/llamacpp-extension/src/preset.test.ts b/extensions/llamacpp-extension/src/preset.test.tsindex 0864de047..2189744b0 100644--- a/extensions/llamacpp-extension/src/preset.test.ts+++ b/extensions/llamacpp-extension/src/preset.test.ts@@ -545,8 +545,8 @@ describe('generatePreset upstream-default skipping', () => {expect(modelSection('c')).not.toContain('n-gpu-layers')})- // mlock and no_mmap are two deprecated aliases for one upstream field, so- // emitting both left load_mode at NONE and silently dropped mlock.+ // mlock and no_mmap were two aliases for one upstream field and are gone as of+ // 0.4.1; load-mode is the only key llama.cpp still accepts.it('derives a single load-mode and never emits mlock or no-mmap', async () => {const cases: Array<[boolean, boolean, string | null]> = [[false, false, null],diff --git a/extensions/llamacpp-extension/src/preset.ts b/extensions/llamacpp-extension/src/preset.tsindex fbb5079db..0c4b946de 100644--- a/extensions/llamacpp-extension/src/preset.ts+++ b/extensions/llamacpp-extension/src/preset.ts@@ -391,10 +391,10 @@ export async function generatePreset() {lines.push(`main-gpu = ${Math.floor(config.main_gpu)}`)}- // `--mlock` and `--no-mmap` are both deprecated aliases that write the single- // params.load_mode field (arg.cpp:2658-2702), so emitting both left load_mode- // at NONE and silently dropped mlock -- and mmap+mlock was unreachable.- // Deriving the one key it actually wants fixes both.+ // `--mlock`, `--mmap`/`--no-mmap` and `--direct-io` were deprecated aliases of+ // the single params.load_mode field and were deleted outright in 0.4.1, so+ // `load-mode` is now the only spelling llama.cpp understands. Jan keeps the two+ // familiar toggles in its settings and derives that one key from them.const wantsMlock = config.mlock === trueconst wantsNoMmap = config.no_mmap === trueif (wantsMlock || wantsNoMmap) {diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lockindex 113d5d379..cc1598fe9 100644--- a/src-tauri/Cargo.lock+++ b/src-tauri/Cargo.lock@@ -7830,7 +7830,7 @@ dependencies = [[[package]]name = "tauri-plugin-llamacpp"-version = "0.4.0"+version = "0.4.1"dependencies = ["base64 0.22.1","byteorder",diff --git a/src-tauri/plugins/tauri-plugin-llamacpp/Cargo.lock b/src-tauri/plugins/tauri-plugin-llamacpp/Cargo.lockindex ded74514f..0e54a8c70 100644--- a/src-tauri/plugins/tauri-plugin-llamacpp/Cargo.lock+++ b/src-tauri/plugins/tauri-plugin-llamacpp/Cargo.lock@@ -3421,7 +3421,7 @@ dependencies = [[[package]]name = "tauri-plugin-llamacpp"-version = "0.4.0"+version = "0.4.1"dependencies = ["base64 0.22.1","byteorder",diff --git a/src-tauri/plugins/tauri-plugin-llamacpp/Cargo.toml b/src-tauri/plugins/tauri-plugin-llamacpp/Cargo.tomlindex 3554d1902..43aefe424 100644--- a/src-tauri/plugins/tauri-plugin-llamacpp/Cargo.toml+++ b/src-tauri/plugins/tauri-plugin-llamacpp/Cargo.toml@@ -1,6 +1,6 @@[package]name = "tauri-plugin-llamacpp"-version = "0.4.0"+version = "0.4.1"authors = ["Jan <[email protected]>"]description = "Tauri plugin for managing Jan LlamaCpp server processes and model loading"license = "MIT"diff --git a/src-tauri/plugins/tauri-plugin-llamacpp/build.rs b/src-tauri/plugins/tauri-plugin-llamacpp/build.rsindex 68bc6edf6..e6093399b 100644--- a/src-tauri/plugins/tauri-plugin-llamacpp/build.rs+++ b/src-tauri/plugins/tauri-plugin-llamacpp/build.rs@@ -13,10 +13,10 @@// vendor/llama.cpp and with engine::PINNED_* on the Rust side; the shim// re-exports llama_version()/llama_build_number() so a mismatch is caught at// runtime instead of producing a silently wrong engine.-pub const LLAMA_CPP_TAG: &str = "b10809";-pub const LLAMA_CPP_BUILD_NUMBER: u32 = 10809;-pub const LLAMA_CPP_COMMIT: &str = "5266f24da75dc449bd56cbed7addb9c8e4a6a73e";-pub const LLAMA_CPP_VERSION: &str = "0.4.0";+pub const LLAMA_CPP_TAG: &str = "b10964";+pub const LLAMA_CPP_BUILD_NUMBER: u32 = 10964;+pub const LLAMA_CPP_COMMIT: &str = "b29c606e28a01b1bc8c1351026a0fa6e616bf6c4";+pub const LLAMA_CPP_VERSION: &str = "0.4.1";const COMMANDS: &[&str] = &[// Cleanup commanddiff --git a/src-tauri/plugins/tauri-plugin-llamacpp/guest-js/types.ts b/src-tauri/plugins/tauri-plugin-llamacpp/guest-js/types.tsindex e25e3c7d0..b081d391f 100644--- a/src-tauri/plugins/tauri-plugin-llamacpp/guest-js/types.ts+++ b/src-tauri/plugins/tauri-plugin-llamacpp/guest-js/types.ts@@ -23,9 +23,9 @@ export interface EngineInfo {/** Mirrors `engine::commands::EngineVersion`. */export interface EngineVersion {- /** llama.cpp's own version, e.g. "0.4.0". */+ /** llama.cpp's own version, e.g. "0.4.1". */version: string- /** Upstream build tag the source was taken from, e.g. "b10809". */+ /** Upstream build tag the source was taken from, e.g. "b10964". */tag: string/** The tag's build number, as a string. */build_number: stringdiff --git a/src-tauri/plugins/tauri-plugin-llamacpp/package.json b/src-tauri/plugins/tauri-plugin-llamacpp/package.jsonindex 37998b83e..5fead7f4f 100644--- a/src-tauri/plugins/tauri-plugin-llamacpp/package.json+++ b/src-tauri/plugins/tauri-plugin-llamacpp/package.json@@ -1,6 +1,6 @@{"name": "@janhq/tauri-plugin-llamacpp-api",- "version": "0.4.0",+ "version": "0.4.1","private": true,"description": "","type": "module",diff --git a/src-tauri/plugins/tauri-plugin-llamacpp/shim/jan_llama_shim.cpp b/src-tauri/plugins/tauri-plugin-llamacpp/shim/jan_llama_shim.cppindex 383a463cf..621e6ae35 100644--- a/src-tauri/plugins/tauri-plugin-llamacpp/shim/jan_llama_shim.cpp+++ b/src-tauri/plugins/tauri-plugin-llamacpp/shim/jan_llama_shim.cpp@@ -379,6 +379,16 @@ jan_llama_engine * jan_llama_engine_start_from_preset(const char * ini_patpostprocess_cpu_params(engine->params.speculative.draft.cpuparams_batch,&engine->params.cpuparams_batch);+ // arg.cpp:886-890, added in 0.4.1: an unset `-mmdev` follows `--device`+ // rather than falling back to auto-placement. Without it a preset that+ // pins the model to one GPU would still let the projector land wherever+ // ggml chose, which is the split the setting exists to prevent.+ if (engine->params.mmproj_use_gpu && engine->params.mmproj_device == nullptr &&+ !engine->params.devices.empty()) {+ engine->params.mmproj_device = engine->params.devices.front();+ engine->params.mmproj_use_gpu = engine->params.mmproj_device != nullptr;+ }+// Same omission, arg.cpp:946-954: common_params_fit needs spare slots// to write its overrides into and throws "did not provide buffer to// set tensor_buft_overrides" without them, so auto-fit silently gavediff --git a/src-tauri/plugins/tauri-plugin-llamacpp/shim/jan_llama_shim.h b/src-tauri/plugins/tauri-plugin-llamacpp/shim/jan_llama_shim.hindex d40b8b811..8c54f1452 100644--- a/src-tauri/plugins/tauri-plugin-llamacpp/shim/jan_llama_shim.h+++ b/src-tauri/plugins/tauri-plugin-llamacpp/shim/jan_llama_shim.h@@ -96,8 +96,8 @@ void jan_llama_string_free(char * s);// The llama.cpp the shim was compiled against, for the pin assertion in// build.rs / engine::assert_pinned_version.-const char * jan_llama_version(void); // e.g. "0.4.0"-int jan_llama_build_number(void); // e.g. 10809+const char * jan_llama_version(void); // e.g. "0.4.1"+int jan_llama_build_number(void); // e.g. 10964const char * jan_llama_commit(void);#ifdef __cplusplusdiff --git a/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/commands.rs b/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/commands.rsindex 1c80861ce..4c0d0f9e8 100644--- a/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/commands.rs+++ b/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/commands.rs@@ -481,9 +481,9 @@ pub async fn get_engine_info(/// therefore no use to a settings screen that wants to name the engine.#[derive(Debug, Clone, Serialize, Deserialize)]pub struct EngineVersion {- /// llama.cpp's own version, e.g. `0.4.0`.+ /// llama.cpp's own version, e.g. `0.4.1`.pub version: String,- /// The upstream build tag the source was taken from, e.g. `b10809`.+ /// The upstream build tag the source was taken from, e.g. `b10964`.pub tag: String,/// The same tag's build number, which is what the shim reports back over/// the FFI and what a version mismatch is checked against.diff --git a/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/mod.rs b/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/mod.rsindex 3a6cf91d1..9506313c0 100644--- a/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/mod.rs+++ b/src-tauri/plugins/tauri-plugin-llamacpp/src/engine/mod.rs@@ -212,9 +212,9 @@ mod tests {#[test]fn pin_constants_are_populated_from_build_rs() {- assert_eq!(PINNED_TAG, "b10809");- assert_eq!(PINNED_BUILD_NUMBER, "10809");- assert_eq!(PINNED_VERSION, "0.4.0");+ assert_eq!(PINNED_TAG, "b10964");+ assert_eq!(PINNED_BUILD_NUMBER, "10964");+ assert_eq!(PINNED_VERSION, "0.4.1");assert_eq!(PINNED_COMMIT.len(), 40, "commit should be a full sha");}diff --git a/web-app/src/containers/__tests__/LlamacppEngineInfo.test.tsx b/web-app/src/containers/__tests__/LlamacppEngineInfo.test.tsxindex 1a0f27bea..947c9c860 100644--- a/web-app/src/containers/__tests__/LlamacppEngineInfo.test.tsx+++ b/web-app/src/containers/__tests__/LlamacppEngineInfo.test.tsx@@ -15,10 +15,10 @@ vi.mock('@/hooks/useServiceHub', () => ({import { LlamacppEngineInfo } from '../LlamacppEngineInfo'const PIN = {- version: '0.4.0',- tag: 'b10809',- buildNumber: '10809',- commit: '5266f24da75dc449bd56cbed7addb9c8e4a6a73e',+ version: '0.4.1',+ tag: 'b10964',+ buildNumber: '10964',+ commit: 'b29c606e28a01b1bc8c1351026a0fa6e616bf6c4',}describe('LlamacppEngineInfo', () => {@@ -31,8 +31,8 @@ describe('LlamacppEngineInfo', () => {render(<LlamacppEngineInfo />)expect(await screen.findByText('llama.cpp')).toBeInTheDocument()- expect(screen.getByText('0.4.0')).toBeInTheDocument()- expect(screen.getByText('b10809')).toBeInTheDocument()+ expect(screen.getByText('0.4.1')).toBeInTheDocument()+ expect(screen.getByText('b10964')).toBeInTheDocument()})// A 40-char sha would wrap the row and buys nothing a reader can use; the@@ -41,13 +41,13 @@ describe('LlamacppEngineInfo', () => {getEngineVersion.mockResolvedValue(PIN)render(<LlamacppEngineInfo />)- expect(await screen.findByText('5266f24d')).toBeInTheDocument()+ expect(await screen.findByText('b29c606e')).toBeInTheDocument()expect(screen.queryByText(PIN.commit)).not.toBeInTheDocument()expect(screen.getByRole('link', { name: /engineReleaseNotes/ })).toHaveAttribute('href',- 'https://github.com/ggml-org/llama.cpp/releases/tag/b10809'+ 'https://github.com/ggml-org/llama.cpp/releases/tag/b10964')})diff --git a/web-app/src/services/models/types.ts b/web-app/src/services/models/types.tsindex 85297f656..cb2f46437 100644--- a/web-app/src/services/models/types.ts+++ b/web-app/src/services/models/types.ts@@ -201,9 +201,9 @@ export interface ModelsService {* extension, not to the plugin.*/export interface EngineVersionInfo {- /** llama.cpp's own version, e.g. "0.4.0". */+ /** llama.cpp's own version, e.g. "0.4.1". */version: string- /** Upstream build tag, e.g. "b10809". */+ /** Upstream build tag, e.g. "b10964". */tag: stringbuildNumber: string/** Full commit sha the build is pinned to. */