fix(llm): add type cast for autoAttempt build option#333
Open
JasonOA888 wants to merge 2 commits intotobi:mainfrom
Open
fix(llm): add type cast for autoAttempt build option#333JasonOA888 wants to merge 2 commits intotobi:mainfrom
JasonOA888 wants to merge 2 commits intotobi:mainfrom
Conversation
Previously, 'qmd embed' always displayed 'Model: embeddinggemma' even when using a custom model via QMD_EMBED_MODEL env var. Root cause: store.ts exports DEFAULT_EMBED_MODEL as a hardcoded display label, while llm.ts uses DEFAULT_EMBED_MODEL_URI for the actual model path. qmd.ts was using the wrong constant. Changes: - Add extractModelDisplayName() helper to extract readable name from URI - Change vectorIndex(), vectorSearch(), querySearch() to use DEFAULT_EMBED_MODEL_URI instead of store's DEFAULT_EMBED_MODEL - Apply extractModelDisplayName() when printing the model name Now correctly shows: - 'embeddinggemma-300M-Q8_0' for default model - 'Qwen3-Embedding-0.6B-Q8_0' for custom models Fixes tobi#328
The 'autoAttempt' value is valid in node-llama-cpp runtime but not included in TypeScript types. This causes build failures: src/llm.ts(548,27): error TS2769: No overload matches this call. Type 'autoAttempt' is not assignable to type 'auto | never | forceRebuild | try | undefined' Fix: Cast to 'any' to bypass type check while preserving runtime behavior. Fixes tobi#317
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
v1.1.5 fails to build with TypeScript compilation error:
Root Cause
The
"autoAttempt"value is valid in node-llama-cpp runtime but not included in TypeScript type definitions.Solution
Cast to
anyto bypass type check while preserving runtime behavior.Alternative Considered
Could use
"try"instead, but"autoAttempt"has better behavior (attempts build without forcing).Fixes #317