Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix cached models missing from chat picker - #7680

Open
ousamabenyounes wants to merge 1 commit into
unslothai:mainfrom
ousamabenyounes:fix/issue-7676
Open

Fix cached models missing from chat picker#7680
ousamabenyounes wants to merge 1 commit into
unslothai:mainfrom
ousamabenyounes:fix/issue-7676

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Summary

  • include usable Hugging Face cache-only models in the chat model picker
  • preserve active repository IDs and inactive snapshot load paths
  • deduplicate only complete cache entries with the same repository and model format
  • make projected local models searchable through the existing local sections

Validation

  • RED → GREEN: removing hf_cache projection fails with the reported model absent; restoring it passes.
  • RED → GREEN: repository-only dedup removes the GGUF fallback beside cached Safetensors; repository-plus-format keeps it.
  • RED → GREEN: untrimmed repository IDs leak a duplicate; normalized IDs deduplicate it.
  • npm test (77/77 passing)
  • npm run typecheck
  • npm run build
  • ESLint and Biome checks for all changed files
  • 100% statements, branches, functions, and lines for the new inventory projector
  • Chromium verification of search, inactive load-path preservation, and duplicate suppression

Full local suite: passed.

Closes #7676

@ousamabenyounes

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and resolved the conflicts in pickers.tsx and
use-chat-picker-inventory.ts.

The conflict mattered: main had since hardened the local-model filter with a
diffusion-task exemption (canChat || studioPageForTask(row.task)) and an
allowedHiddenModelIds bypass. This rework keeps that filter verbatim and
only layers the fix on top:

  • add hf_cache to PICKER_LOCAL_SOURCES;
  • drop an hf_cache row only when the same repo+format is already surfaced as a
    complete cached model (isHfCacheDuplicate, keyed on repoId\nmodelFormat;
    partial / live-downloading cached rows are intentionally excluded so the cache
    copy stays visible until the download finishes);
  • project hf_cache rows under the models_dir source. This is required, not
    cosmetic: the picker buckets localModels by source into exactly
    lmstudio / models_dir / custom (pickers.tsx), so an entry left as
    hf_cache would match no bucket and stay invisible — the very bug this fixes.

The reusable matching/dedup logic moved into a pure, unit-tested module
(chat-picker-inventory-sources.ts).

Verification (local):

  • chat-picker-inventory-sources.test.ts: 5/5 pass; mutation-checked (breaking
    the format in the dedup key fails a case, so the test is not vacuous).
  • full frontend test suite: 2707/2707 pass (no regression).
  • tsc typecheck: clean.
  • eslint: 0 new errors vs the main baseline (pre-existing pickers.tsx
    warnings unchanged).
  • Not run in this environment: a real browser pass on the picker screen.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71b482bb14

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

return (
row.source === LOCAL_MODEL_SOURCE.HF_CACHE &&
row.repoId !== null &&
completeCachedKeys.has(inventoryKey(row.repoId, row.modelFormat))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize non-GGUF cache rows before deduplicating

When a complete Diffusers/video repository is returned by both inventory endpoints, its cached row is classified as safetensors, while _scan_hf_cache reports the non-GGUF local twin as unknown. Requiring the formats to match therefore retains both rows; the task exemption in useChatPickerInventory then admits the unknown local row, so the Images/Video picker displays the same snapshot once as cached and again under Local models. Normalize this HF-cache format before comparison, or otherwise treat this known unknown/safetensors pair as a duplicate while preserving genuinely distinct GGUF copies.

Useful? React with 👍 / 👎.

@danielhanchen

Copy link
Copy Markdown
Member

Confirmed this hits use-chat-picker-inventory.ts where PICKER_LOCAL_SOURCES still omits hf_cache, so a cache-only repo never reaches the local lists, and the rebase kept the canChat and hidden-id filter intact. Will get this reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Local model not being displayed in list of local models, but can be loaded through Search Hub

2 participants