Add local LLM playground#590
Merged
Merged
Conversation
…board, SSE)
Self-review of the local-llm-playground branch surfaced two reachability
contract breaks and several runtime/robustness gaps:
- Register the playground in NAV_COMMANDS so it's reachable from ⌘K and
voice (the route alone left it un-navigable per the nav-manifest rule).
- Add /local-llm/ to Layout's isFullWidth list — the page owns its own
h-full + inner overflow-auto, so the default padded main double-scrolled
and clipped content below the fold.
- Replace the inline navigator.clipboard?.writeText().then() with the
canonical copyToClipboard helper, which doesn't throw on insecure-origin
HTTP (the common Tailscale-remote case) and owns the success/fail toasts.
- Guard the SSE frame parse: one malformed data: frame previously threw out
of the read loop and discarded every token already streamed. Extracted a
pure, unit-tested extractStreamDelta() that skips bad frames.
- Always reader.cancel() in a finally so an aborted/timed-out stream
releases the reader and tears down the socket.
- Number inputs: an emptied temperature/maxTokens field coerced via
Number('') to 0 (silent temp 0, or a 400 on maxTokens' min(1)); fall back
to the field default via numOr().
- Prune deleted models from the pending compare set so openCompare can't
ship a dead modelId the playground would error on.
- Guard the playground's async setState behind a mountedRef.
- Report charsPerSecond as null (n/a) for a zero-duration run instead of
surfacing the char count as a rate.
- Add localLlmPlayground.test.js covering the previously-untested pure
helpers (buildPrompt/buildMessages/summarizeTimings/extractStreamDelta).
Deferred to PLAN.md: preserve partial output on timeout, an in-flight
cancel button, and extracting the shared target-key helper.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification