unsloth/studio/backend/utils/datasets
Wasim Yousef Said 50cccfd55e
feat(chat): server-side timings, context display & source hover cards (#4467)
* feat(chat): add server-side timings and context display for GGUF

Extract timings/usage metadata from llama-server SSE stream and forward
through the full stack. Replace client-side estimates with accurate
server-reported metrics (prompt eval, tok/s, token counts, cache hits).
Add context window usage bar to chat top nav.

* feat(chat): source badges with hover cards and 2-row collapse

- Add hover cards to source badges showing favicon, title, URL and
  snippet description on hover
- Limit source badges to 2 rows with +X more expand/collapse
- Parse snippet from web search results for hover card descriptions
- Replace individual Source rendering with grouped SourcesGroup component

* fix(chat): add null guards for server timings edge cases

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

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

* fix(chat): reset contextUsage on thread switch, remove unused context-display

* fix(chat): stop double-counting completion tokens in tool-calling path

* fix(chat): skip metadata events in llm_assist consumers

* fix(chat): hide context usage bar in compare mode

* fix(chat): harden timings pipeline and context usage persistence

Accumulate prompt_ms, predicted_ms, and predicted_n from intermediate
tool-detection passes so the final metadata reflects total server work.
Persist contextUsage in message metadata (Dexie) and restore on thread
load. Add type guard in gguf_stream_chunks for unexpected dict events.
Clear contextUsage when entering compare mode.

* feat(chat): make GGUF stream metadata OpenAI-compatible

* fix(chat): address PR review feedback

* feat(chat): address PR review feedback

* [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-03-20 23:42:01 -07:00
..
__init__.py Update license headers 2026-03-12 17:23:10 +00:00
chat_templates.py studio: web search, KV cache dtype, training progress, inference fixes 2026-03-17 00:30:01 -07:00
data_collators.py Final cleanup 2026-03-12 18:28:04 +00:00
dataset_utils.py studio: web search, KV cache dtype, training progress, inference fixes 2026-03-17 00:30:01 -07:00
format_conversion.py Final cleanup 2026-03-12 18:28:04 +00:00
format_detection.py Final cleanup 2026-03-12 18:28:04 +00:00
llm_assist.py feat(chat): server-side timings, context display & source hover cards (#4467) 2026-03-20 23:42:01 -07:00
model_mappings.py studio: improve onboarding UX, tooltips, and training defaults (#4355) 2026-03-17 07:46:07 -07:00
vlm_processing.py Final cleanup 2026-03-12 18:28:04 +00:00