unsloth/studio/backend/routes
Leo Borcherding 478d30f361
Unsloth Studio (desktop): fix canvas preview, download file button, toast placement, and model-load typing lag (#7391)
* Studio desktop: fix loading-toast overlap and typing lag on model load

- Toaster: on desktop, offset toasts below the ~34px custom window titlebar
  (top 46 when isTauri) so they no longer cover the min/max/close controls.
  Web is unchanged (top 12).
- Model load: the 2s load poll wrote loadProgress state every tick, which
  re-renders the whole chat page during "Starting model" (cheap in Chrome,
  janky in the desktop WebView2 -> laggy typing). That state is only read by
  the dismissed-toast inline status, so gate all four poll branches to write
  it only when the inline view is live; while the toast is up it updates via
  Sonner alone.

* Studio desktop: fix HTML canvas preview, download, and panel offset

- CSP: add frame-src for localhost/127.0.0.1 so the desktop webview can
  frame the backend-served artifact preview. default-src 'self' (no
  frame-src) blocked it -> "127.0.0.1 refused to connect"; web is
  same-origin so it already worked.
- Download: route the canvas Download button through the native save
  dialog (downloadFile) instead of a blob-anchor click, which the Tauri
  WebView2 silently drops.
- Nudge the artifact panel down 8px so its top edge/shadow isn't tucked
  under the window top bar.

* Studio desktop: add HTML filter for native canvas save dialog

Canvas Download saves .html via save_native_file, but save_filter() had no
html/htm case, so the native dialog fell back to the JSON/CSV/etc filter and
could block saving/browsing the .html export. Add an HTML filter and include
html/htm in the catch-all. Addresses Codex review on #7391.

* Studio desktop: unblock canvas preview in dev shell + clear header fade

- Preview: the app CSP frame-src fix wasn't enough in the tauri dev shell.
  The preview endpoint sets its own frame-ancestors response header, which
  only allowed 'self' tauri://localhost http://tauri.localhost -- so the
  Vite dev origin (http://localhost:5173) was blocked and the frame stayed
  "refused to connect". Extend the allowlist with http://localhost:* and
  http://127.0.0.1:* (the endpoint only renders postMessage'd HTML in a
  no-same-origin sandbox, so it exposes no server resource).
- Shadow: the artifact panel toolbar sat under the full-width
  chat-header-fade; lower the panel top (mt 80->90px) so the controls clear
  the fade.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-07-24 22:23:41 -05:00
..
data_recipe Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
.gitkeep root studio folder 2026-02-02 09:13:49 +00:00
__init__.py Studio: clean-room compact RAG (knowledge bases, hybrid search, fast indexing) (#5910) 2026-06-09 21:17:04 -07:00
auth.py Studio: reject whitespace-only passwords (#7341) 2026-07-23 00:44:37 -07:00
chat_history.py feat(studio): presets include load settings (#7347) (#7352) 2026-07-24 02:23:43 -07:00
datasets.py Studio: add configurable model download location (#7274) 2026-07-23 01:34:38 -07:00
export.py Studio: offer the latest transformers release for brand-new architectures (#7056) 2026-07-15 05:25:26 -07:00
inference.py Unsloth Studio (desktop): fix canvas preview, download file button, toast placement, and model-load typing lag (#7391) 2026-07-24 22:23:41 -05:00
llama.py Studio: add local speech-to-text dictation engine (#7095) 2026-07-23 01:39:03 -07:00
mcp_servers.py Replace standalone Studio wording with Unsloth (#7221) 2026-07-19 00:47:04 -07:00
models.py feat(studio): expose full KV cache dtype list in model config UI (#7348) 2026-07-24 02:22:03 -07:00
preview.py Studio: opt-in OpenAI /v1 model auto-switch and idle keep-warm (#6392) 2026-07-01 06:42:23 -07:00
prompts.py Studio: clean-room compact RAG (knowledge bases, hybrid search, fast indexing) (#5910) 2026-06-09 21:17:04 -07:00
providers.py fix(studio): persist connection model selections for remote clients (#7298) 2026-07-23 19:11:50 -07:00
rag.py Studio: Data settings tab, uploaded files manager, quant pinning, and chat image preview fix (#7029) 2026-07-20 04:57:44 -07:00
settings.py Studio: add configurable model download location (#7274) 2026-07-23 01:34:38 -07:00
training.py feat(studio): add DoRA support to studio (#7315) 2026-07-24 03:24:16 -07:00
training_history.py Studio: require signed capability tokens for /p preview links (#6666) 2026-06-25 21:40:48 -07:00
training_vram.py Add Intel XPU support to Unsloth Studio (#4724) 2026-07-24 02:22:07 -03:00
whisper.py Studio: add local speech-to-text dictation engine (#7095) 2026-07-23 01:39:03 -07:00