Skip to content

Conversation

@qnixsynapse
Copy link
Contributor

Describe Your Changes

  • Removed duplicated TypeScript type definitions for LlamacppConfig, ModelPlan, DownloadItem, ModelConfig, etc.
  • Added a new src/guest-js/types.ts that exports the consolidated types and a helper normalizeLlamacppConfig for converting raw config objects.
  • Implemented a dedicated Rust module args.rs that builds all command‑line arguments for llama.cpp from a LlamacppConfig struct, handling embedding, flash‑attention, GPU/CPU flags, and other options.
  • Updated commands.rs to construct arguments via ArgumentBuilder, validate paths, and log the generated args.
  • Added more explicit error handling for invalid configuration arguments and updated the error enum to include InvalidArgument.
  • Exported the new cleanupLlamaProcesses command and updated the guest‑JS API accordingly.
  • Adjusted the TypeScript loadLlamaModel helper to use the new config normalization and argument shape.
  • Improved logging and documentation for clarity.

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 Nov 18, 2025

Barecheck - Code coverage report

Total: 30.06%

Your code coverage diff: 0.00% ▴

✅ All code changes are covered

- Removed duplicated TypeScript type definitions for LlamacppConfig, ModelPlan, DownloadItem, ModelConfig, etc.
- Added a new `src/guest-js/types.ts` that exports the consolidated types and a helper `normalizeLlamacppConfig` for converting raw config objects.
- Implemented a dedicated Rust module `args.rs` that builds all command‑line arguments for llama.cpp from a `LlamacppConfig` struct, handling embedding, flash‑attention, GPU/CPU flags, and other options.
- Updated `commands.rs` to construct arguments via `ArgumentBuilder`, validate paths, and log the generated args.
- Added more explicit error handling for invalid configuration arguments and updated the error enum to include `InvalidArgument`.
- Exported the new `cleanupLlamaProcesses` command and updated the guest‑JS API accordingly.
- Adjusted the TypeScript `loadLlamaModel` helper to use the new config normalization and argument shape.
- Improved logging and documentation for clarity.
Prevent adding the `--mmproj` flag when the provided path string is empty.
An empty `mmproj_path` previously caused an empty argument to be passed to the model loader, potentially leading to errors or undefined behavior. By filtering out empty strings before pushing the flag, the command line construction is now robust against malformed input.
Use `String::new()` instead of `“”.to_string()` when no API key is supplied.
This eliminates an unnecessary heap allocation and clarifies that the intent is to create an empty string without creating a temporary literal.
@qnixsynapse qnixsynapse force-pushed the chore/argument_handler branch from a92ef97 to 997efdd Compare November 20, 2025 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants