Repository navigation
Unsloth Studio: redesigned API page, multi-model support and a Run settings fix - #14455
Conversation
…ls, and a Run settings fix
… Eject on the API page
…learer dark status tabs
…oom under Remember
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (1)ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
…ly tighter corners
…s tile text sits centered
…ng defaults, guarded primary Run settings, standalone GGUF settings key
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex security review |
…cache snapshots open their repo settings
|
@codex security review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
## Problem Five checks fail on main, so the `Repo tests (CPU, studio)`, `Repo tests (CPU, rest)` and `workflow-trigger lint` shards are red on every open PR (for example #14472, #14482, #14488, #14490 and #14494). All five reproduce on main `4d7ebf5cea`. | Test | Introduced by | Fault | |---|---|---| | `tests/security/test_lint_risky_loaders.py::test_the_tree_matches_the_baseline` | #14437 | Baseline. Two new dynamic-import sites: `import_module` in `studio/backend/core/rag/embeddings.py`, and a third `import_from_string` in `unsloth/models/sentence_transformer.py` (`_require_word_tokenizer`). Both are safe, see below. | | `tests/studio/test_tauri_branding_contract.py::test_desktop_surfaces_do_not_restore_studio_branding` | #14473 | Product. "Studio" became "Unsloth Studio" in the Markdown import errors and the Tauri webview reject message. The desktop contract allows "Unsloth" there, never "Unsloth Studio". "Unsloth" meets both #14473's rule (no bare "Studio") and this one. | | `tests/studio/test_usage_examples_model_source_contract.py::test_auto_switch_section_sits_above_the_usage_examples` | #14455 | Test. The redesign moved the usage examples above the monitor link on purpose, and its own `api-settings-tab.test.ts` pins that. | | `tests/studio/test_usage_examples_model_source_contract.py::test_monitor_can_unload_the_loaded_model` | #14455 | Test. Unloading moved from a standalone button on the page into the model picker's eject (`ApiModelLoadControls`). The `/unload` path itself is unchanged. | | `tests/studio/test_settings_compact_overflow_contract.py::test_api_monitor_entries_and_expanded_text_can_shrink` | #14455 | Test. Entry rows are now rounded cards (no `border-b`), and the prompt/reply box's `rounded-lg` became conditional, so the class literals the test matched are gone. The overflow guards themselves are still in the source. | ## Fix - **Risky loaders:** two baseline entries with reasons. - `embeddings.py` imports only the three `sentence_transformers.models` paths written out in a literal tuple, to wrap their `import_from_string` with the trust gate. - `_require_word_tokenizer` imports only after its caller has refused any `tokenizer_class` outside `sentence_transformers.*`, and only dotted identifiers. - **Branding:** "Unsloth Studio" to "Unsloth" in those seven Markdown import errors and the Rust reject message. `conversation-markdown-import.test.ts` now matches `/Unsloth Markdown/`. - **#14455 contracts:** rewritten to guard what the redesign keeps: - the auto-switch section still follows the monitor link, and the usage examples come before both; - the page passes `unloadActiveModel` to the load controls as `onUnloadActive`, and eject is withheld while `busy` (`modelLoading || unloading`, #11223's rule); - the `/unload` call still reads the internal id from status; - entry rows keep `w-full min-w-0`; - the prompt/reply box keeps `max-h-72 overflow-auto break-words`; - the model id keeps `min-w-0 break-all`. ## Verification - The four Python files: 78 passed (5 failed on main). - `studio/frontend/tests/conversation-markdown-import.test.ts`: 20 passed. - Sabotage, each run against the rewritten tests, each failing exactly one test: - removing `min-w-0` from the entry row, or `break-words` from the text box: the overflow test fails; - dropping `unloading` from `busy`, or passing `onEject` while busy: the unload test fails; - putting the auto-switch section above the monitor link: the order test fails.
Unsloth Studio: redesigned API page, multi-model support and a Run settings fix
The API page grew one control at a time and read as a row of seven unrelated buttons over six oversized cards. It also only knew about one model, even with "Keep multiple models loaded" on. This reorganizes it around what people come to it for: where to point a client, which models are serving, and what the last requests did.
Layout
modelvalue to send (quant included, copy on hover with its slot reserved), a Run settings button, an API example button, Context and Slots on the primary model, and a per-model eject.curlrequest against this server's base URL and the loaded model, plus a button into API keys and more examples.elevated-card bg-card): a soft border and glow in light mode, borderless in dark mode. Corners on the API page and the API example sit a step tighter (cards 32 to 29 px, boxes 2 px less), scoped by anapi-roundingclass so Train keeps its own.Multiple models
API example
The code icon on each model row opens a dialog with a syntax-highlighted Python OpenAI-client request for that model, carrying the sampling the server fills in for omitted fields. The values come from a new
GET /api/inference/sampling-defaults?model=, which runs the same resolution as the request path (operatorUNSLOTH_SAMPLING_*pins, then the model's recommendation, then the schema default).The endpoint routes to a kept model's own slot and passes the loaded model's default thinking mode, as
/v1/chat/completionsdoes, and resolves nothing against a resident hidden from the caller (another account's model stays private, as on the monitor).Only one row is the primary even when two local files share a public name, so Eject and Run settings act on the right file. A kept standalone
.ggufor HF cache snapshot opens the same saved settings record the picker uses.Performance
The page stops polling the monitor while the tab or window is hidden and polls at once when it shows again. It used to poll every 1.5 s in a background tab or a minimized Desktop window.
Each poll shares unchanged entries with the previous snapshot (
monitor-snapshot.ts), and request rows are memoized, so a quiet server re-renders nothing and a busy one re-renders only the rows that changed. The relative-time clock ticks only while the log has rows, and search filtering is deferred so typing stays responsive.On the Remote & LAN tab, the remote and LAN status polls skip their request while the window is hidden. LAN URLs publish to the shared store only when they change: every poll used to hand over a fresh array, re-rendering each base URL reader every five seconds.
Floating API monitor
API settings tab
Run settings
model-selector.tsx, so Chat's shortcut benefits too).Other fixes
contrast-slider.test.ts). It now uses the contrast-aware wash.text-ui-22, a token that does not exist.Screenshots
Light mode, two models loaded side by side:
Dark mode:
Model rows: Run settings and API example icons beside each model:
API example for gemma-3-270m, showing its recommended sampling (temperature 1, top_p 0.95, top_k 64):
Copy buttons fade in on hover without moving the row:
Verification
npm run typecheck,npm test(13099 pass, 0 fail),npm run build. Backend:pytest studio/backend/tests/test_sampling_defaults_route.py(2 pass). New frontend tests:api-monitor-snapshot.test.ts(snapshot sharing, tab counts, floating monitor polling),api-settings-tab.test.ts, an input/output case inapi-monitor-throughput.test.ts,api-sampling-example.test.tsand a kept-model case inapi-monitor-slots-settings-request.test.ts.unsloth/SmolLM2-135M-Instruct-GGUFandunsloth/gemma-3-270m-it-GGUF(Q4_K_M) loaded side by side under "Keep multiple models loaded: When they fit". I sent requests naming each model, ejected the primary from its row (only that one unloaded, the page still read Ready), and opened Run settings for the kept model (its own page opens), and opened the API example for each model (SmolLM shows temperature 0.7, gemma temperature 1 and top_k 64, matching their recommendations).Not covered here