Skip to content

Studio: embedding model picker, pins and eject in the RAG menu - #12875

Merged
shimmyshimmer merged 14 commits into
mainfrom
studio/rag-embedding-picker
Oct 7, 2026
Merged

shimmyshimmer merged 14 commits into
mainfrom
studio/rag-embedding-picker

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds an embedding model picker to the RAG menu, plus pinning so people can switch between embedding models without going back to Settings each time. Also tidies the Settings embedding row and lets the embedding model be ejected from both places.

RAG menu

  • The "Retrieve from" heading gets a "Model bge-small-en-v1.5 ›" chip. It shows for the account owner only, since every /api/settings/embedding-model route is owner only.
  • Clicking the chip swaps the menu contents in place to the model list, rather than opening a second popup. The list has a small page header: a back button (hover wash only, "Back to sources"), the title "Embedding model" with "Powers file search" under it, and More models, which opens Settings > General scrolled to Documents & RAG (new general-rag-embedding scroll target).
  • Only the model rows scroll; the header and Eject stay in place. Focus moves into the new view after each swap, so arrow keys keep working.
  • Rows list the current model (ticked), the default model ("unsloth · Default"), then pinned models. The current row also says Loaded or Not loaded. Picking a row switches the embedding model:
    • On disk: "Embedding model set to {model}" with the existing re-index note.
    • Not on disk: it still switches, then says "{model} is not downloaded yet" with an Open settings action, since the loader is cache only and indexing needs the files first.
    • Rejected by the resolver or the save: an error toast with the reason.
  • Each row has a grey pin toggle on hover, using the same pin and unpin icons as Recents. With nothing pinned, a Pin more models link opens the same Settings row.
  • Eject model shows at the bottom while an embedding model is in memory.

Settings > Documents & RAG

  • The embedding row keeps a one line description. The longer explanation and the re-index note move behind an info icon next to the label.
  • The status reads On device, Loaded, Not downloaded, Downloading or Checking, each with a dot. On device and Loaded get their own info icon explaining what they mean.
  • When the model is on disk but not in memory, "Not loaded" shows under the picker with its own info icon.
  • The picker trigger shows a green tick while the model is loaded and turns into a red eject icon on hover, the same as the chat model picker. Nothing shows when no embedder is resident.
  • Every row in the picker list gets a pin toggle on hover. Pinning does not select the model, and pinned models stay listed even when the search does not return them, so they can always be unpinned there.

Implementation

  • useEmbeddingPinsStore: pinned model ids in localStorage (unsloth_embedding_pins), mirrored to the account like the model picker pins, so an account switch's localStorage purge does not lose them. pins-mirror.ts moves to src/lib and gains an embedding list; /api/settings/pinned-models gains a matching embedding field, stored per account as rag_embedding_pinned.
  • switchEmbeddingModel keeps the Settings picker's order: claim save order, resolve, then save what the resolve found (GGUF repo and backend), through the shared useEmbeddingModelStore. A pick made in Settings and one made in the RAG menu cannot land out of order.
  • ejectEmbeddingModel goes through the store's existing applyResidency(unloadEmbeddingModel) path, the same one Settings uses, so it never takes a place in save order.
  • embeddingModelName / embeddingModelOwner turn repo ids and local paths into row labels.
  • The chip class shared with the Sandbox chip is renamed from sandbox-level-chip to menu-heading-chip.
  • "Unload" becomes "Eject" to match the chat model picker. New strings are translated for all 14 locales.

Testing

cd studio/frontend
npm test
npm run typecheck
npm run i18n:check
npm run build
  • npm test: 10781 pass, 0 fail.
  • pytest tests/test_account_chat_settings.py -k pinned: 6 pass, covering the new embedding list.
  • typecheck, i18n:check and build pass. No new lint errors in touched files.
  • rag-embedding-picker.test.ts covers the switch outcomes (saved, needs download, resolver error, superseded, failed resolve still saves, failed save), eject going through the residency path, name and owner parsing, row order, the owner only chip and in place list swap, the Settings deep link, pin wiring and styling, the info hints, and Eject only showing while a model is resident.
  • Checked in a local Studio:
    • Pinned two models in Settings; both showed in the RAG list, and the Settings selection did not change.
    • Switching to a model not on disk showed the download toast. Switching back showed the success toast. The chip and tick followed each switch.
    • Unpinning from the RAG list removed the row without selecting it, and the menu stayed open.
    • More models landed on Documents & RAG.
    • With the model on disk but idle, Settings showed On device and Not loaded, and no eject icon on the picker.

- "Embedding <model> >" chip in the RAG menu heading, owner only. Click opens a
  picker with the current, default and pinned models; picking one switches the
  embedding model. Change model opens Settings at the embedding model row.
- Pin buttons on Settings > Documents & RAG picker rows and in the RAG picker.
  Pins are stored per browser.
- switchEmbeddingModel mirrors the Settings save order (claim, resolve, save)
  and reports models that still need a download.
- Rename the shared chip class to menu-heading-chip.
@danielhanchen

Copy link
Copy Markdown
Member

Status of the red checks here:

@danielhanchen

Copy link
Copy Markdown
Member

Correction to my earlier note: the Frontend unit tests (Windows) failure in source Markdown renders in an assistant root scope without a message part is not from this PR. That test cold-starts Vite in a child process under a 30 s cap and timed out on the loaded Windows runner; it hit #12900 the same way. The fix is in #12903. The (Python 3.13, rest) failure here was test_wsl_host, fixed on main by #12863, so a rebase or re-run clears both.

- RAG menu: the Model chip swaps the menu to the model list in place, with Select model, More models, hover-only grey pins and Eject while a model is resident.
- Settings: long description and re-index note move behind an info hint; status shows On device with a hint, and Not loaded under the picker.
- Picker trigger shows a tick when loaded and ejects on hover, like the chat model picker.
@shimmyshimmer shimmyshimmer changed the title Studio: embedding model picker and pins in the RAG menu Studio: embedding model picker, pins and eject in the RAG menu Oct 7, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T09:38:11.383266Z cb35f22 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: cb35f22ab3

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

2 participants