fix(embed): display actual model name from QMD_EMBED_MODEL env var#332
Open
JasonOA888 wants to merge 1 commit intotobi:mainfrom
Open
fix(embed): display actual model name from QMD_EMBED_MODEL env var#332JasonOA888 wants to merge 1 commit intotobi:mainfrom
JasonOA888 wants to merge 1 commit 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
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
When using
QMD_EMBED_MODELto switch to a different embedding model,qmd embedstill displaysModel: embeddinggemmaeven though the correct model is downloaded and used.Root Cause
Two different
DEFAULT_EMBED_MODELconstants exist:store.ts:47- hardcoded display label"embeddinggemma"llm.ts:196- actual model URI (respectsQMD_EMBED_MODELenv var)qmd.tswas importing and using the wrong constant for display.Solution
extractModelDisplayName()helper to extract readable name from model URIDEFAULT_EMBED_MODEL_URI(llm.ts) instead ofDEFAULT_EMBED_MODEL(store.ts)extractModelDisplayName()when printing the model nameResult
Now correctly shows:
Fixes #328