Show retrieval speed in the demo-mode web UI#45
Merged
Conversation
In demo mode, surface how fast a hybrid search is — a "⚡ N ms over X chunks ·
Y files" badge beside the results count — so a public demo makes CodeRAG's core
speed advantage tangible, clearly separate from the optional, slower AI answer.
- webui: time the .search() call in _run_search and pass search_ms to the home
template; render the badge only under {% if demo %}.
- api: add CodeRAG.warm() (loads provider/store/vectors + the embedding model) so
the first demo query reflects warm latency, not the one-off lazy model load;
run_ui and the MCP server's _warm_up now both use it.
- templates/css: demo-only .speed-badge; reword the demo banner to frame search
as instant and local, and AI answers as a separate, capped step.
- tests: badge present in demo mode (+ reworded banner), absent otherwise.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PKDkohprCqYpiLmB1xx4sC
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
What & why
Follow-up to #44 (the MCP surface + the "find code faster than a grep loop" README pitch). That pitch's core claim — fast local retrieval — was only a number in the docs. This makes it tangible in the product: in demo mode, the web UI now shows how fast a hybrid search was, right next to the results count:
It's deliberately scoped to demo mode (the public showcase) and framed as retrieval time only — clearly separate from the optional, slower LLM "Generate answer" step (which stays its own section).
Changes
webui.py—_run_searchtimes the.search()call (retrieval only — not filtering/highlighting) withtime.perf_counter, andhome()passessearch_msto the template.templates/index.html+static/app.css— a.speed-badgerendered only under{% if demo %}; outside demo mode the UI is unchanged. The badge is labelled "Local hybrid retrieval time — separate from the optional AI answer".api.py— newCodeRAG.warm()(loads provider/store/vectors and the embedding model) so the first demo query reflects warm latency instead of the one-off lazy model load.run_uiand the MCP server's_warm_upnow both route through it (one shared warm path).templates/base.html— demo banner reworded to frame search as instant/local and AI answers as a separate, capped step.tests/test_webui.py— badge present in demo mode (+ the reworded banner), absent otherwise.Verification
pytest -m "not integration"→ 141 passed;ruff check/ruff format --check/mypy coderagclean.TestClient+ thefakeprovider (the real model download isn't reachable in this sandbox). On real corpora the badge reads e.g. "⚡ 12 ms over 553 chunks · 90 files".Not in scope (deferred)
HybridSearcher.elapsed_mson the HTTP API/searchand MCPsearch_coderesponses.🤖 Generated with Claude Code
https://claude.ai/code/session_01PKDkohprCqYpiLmB1xx4sC
Generated by Claude Code