refactor: Simplify Tauri plugin calls and update 'FA' setting #6779
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
, andget_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 toguest-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-basedflash_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
Self Checklist