Skip to content

Add local LLM playground#590

Merged
atomantic merged 3 commits into
mainfrom
codex/local-llm-playground
Jun 1, 2026
Merged

Add local LLM playground#590
atomantic merged 3 commits into
mainfrom
codex/local-llm-playground

Conversation

@atomantic
Copy link
Copy Markdown
Owner

Summary

  • Add a local LLM playground route for chatting with an installed model and viewing latency/output metrics.
  • Add compare mode for selected installed local models, with round-robin or parallel execution and per-model speed/output results.
  • Wire installed-model rows to Chat and Compare actions, plus server routes, validation, and focused route/schema tests.

Verification

  • npm test -- routes/localLlm.test.js
  • npx eslint src/pages/LocalLlmPlayground.jsx src/components/settings/LocalLlmTab.jsx src/App.jsx
  • npm run build
  • node --check server/services/localLlmPlayground.js && node --check server/routes/localLlm.js && git diff --check
  • Browser render check of the playground route; local API/model backend was not running, so live inference was not manually exercised.

atomantic added 3 commits May 31, 2026 22:42
…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.
@atomantic atomantic merged commit 860bd10 into main Jun 1, 2026
2 checks passed
@atomantic atomantic deleted the codex/local-llm-playground branch June 1, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant