Skip to content

Conversation

@qnixsynapse
Copy link
Contributor

Describe Your Changes

This commit introduces significant improvements to the llama.cpp extension, focusing on the 'Flash Attention' setting and refactoring Tauri plugin interactions for better code clarity and maintenance.

The backend interaction is streamlined by removing the unnecessary libraryPath argument from the Tauri plugin commands for loading models and listing devices.

  • Simplified API Calls: The loadLlamaModel, unloadLlamaModel, and get_devices functions in both the extension and the Tauri plugin now manage the library path internally based on the backend executable's location.

  • Decoupled Logic: The extension (src/index.ts) now uses the new, simplified Tauri plugin functions, which enhances modularity and reduces boilerplate code in the extension.

  • Type Consistency: Added UnloadResult interface to guest-js/index.ts for consistency.

  • Updated UI Control: The 'Flash Attention' setting in settings.json is changed from a boolean checkbox to a string-based dropdown, offering 'auto', 'on', and 'off' options.

  • Improved Logic: The extension logic in src/index.ts is updated to correctly handle the new string-based flash_attn configuration. It now passes the string value ('auto', 'on', or 'off') directly as a command-line argument to the llama.cpp backend, simplifying the version-checking logic previously required for older llama.cpp versions. The old, complex logic tied to specific backend versions is removed.

This refactoring cleans up the extension's codebase and moves environment and path setup concerns into the Tauri plugin where they are most relevant.

Fixes Issues

  • Closes #
  • Closes #

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2025

Barecheck - Code coverage report

Total: 30.06%

Your code coverage diff: -0.01% ▾

✅ All code changes are covered

…etting

This commit introduces significant improvements to the llama.cpp extension, focusing on the 'Flash Attention' setting and refactoring Tauri plugin interactions for better code clarity and maintenance.

The backend interaction is streamlined by removing the unnecessary `libraryPath` argument from the Tauri plugin commands for loading models and listing devices.

* **Simplified API Calls:** The `loadLlamaModel`, `unloadLlamaModel`, and `get_devices` functions in both the extension and the Tauri plugin now manage the library path internally based on the backend executable's location.
* **Decoupled Logic:** The extension (`src/index.ts`) now uses the new, simplified Tauri plugin functions, which enhances modularity and reduces boilerplate code in the extension.
* **Type Consistency:** Added `UnloadResult` interface to `guest-js/index.ts` for consistency.

* **Updated UI Control:** The 'Flash Attention' setting in `settings.json` is changed from a boolean checkbox to a string-based dropdown, offering **'auto'**, **'on'**, and **'off'** options.
* **Improved Logic:** The extension logic in `src/index.ts` is updated to correctly handle the new string-based `flash_attn` configuration. It now passes the string value (`'auto'`, `'on'`, or `'off'`) directly as a command-line argument to the llama.cpp backend, simplifying the version-checking logic previously required for older llama.cpp versions. The old, complex logic tied to specific backend versions is removed.

This refactoring cleans up the extension's codebase and moves environment and path setup concerns into the Tauri plugin where they are most relevant.
This commit introduces a functional flag for embedding models and refactors the backend detection logic for cleaner implementation.

Key changes:

 - Embedding Support: The loadLlamaModel API and SessionInfo now include an isEmbedding: boolean flag. This allows the core process to differentiate and correctly initialize models intended for embedding tasks.

 - Backend Naming Simplification (Refactor): Consolidated the CPU-specific backend tags (e.g., win-noavx-x64, win-avx2-x64) into generic *-common_cpus-x64 variants (e.g., win-common_cpus-x64). This streamlines supported backend detection.

 - File Structure Update: Changed the download path for CUDA runtime libraries (cudart) to place them inside the specific backend's directory (/build/bin/) rather than a shared lib folder, improving asset isolation.
Previously the condition for `flash_attn` was always truthy, causing
unnecessary or incorrect `--flash-attn` arguments to be added. The
`main_gpu` check also used a loose inequality which could match values
that were not intended. The updated logic uses strict comparison and
correctly handles the empty string case, ensuring the command line
arguments are generated only when appropriate.
Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qnixsynapse qnixsynapse merged commit b2a8efd into dev Nov 1, 2025
17 checks passed
@qnixsynapse qnixsynapse deleted the refactor/backend branch November 1, 2025 18:00
@github-project-automation github-project-automation bot moved this to QA in Jan Nov 1, 2025
@github-actions github-actions bot added this to the v0.7.4 milestone Nov 1, 2025
@louis-jan louis-jan mentioned this pull request Nov 3, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: QA

Development

Successfully merging this pull request may close these issues.

bug: looks like llamacpp-extension is always setting --no-mmap

3 participants