Skip to content

feat: answer reuse, voice questions and an installable app - #35

Merged
im-rk merged 4 commits into
mainfrom
feature/answer-cache-voice-ask-pwa
Oct 3, 2026
Merged

im-rk merged 4 commits into
mainfrom
feature/answer-cache-voice-ask-pwa

Conversation

@im-rk

@im-rk im-rk commented Oct 3, 2026

Copy link
Copy Markdown
Member

What

  • Answer reuse: an identical question (case, spacing, trailing "?" ignored) in the same scope returns the stored answer with no retrieval and no AI call: about 1 s against about 12 s cold, and no Gemini/Groq quota. It expires after 24 h and whenever any session is added, published or changed, so it can't cite a changed library. pnpm prewarm warms the demo questions and their reels (and stops if credits > 90%).
  • Voice question: a microphone in the Ask bar, English (India) or Hindi, using the browser's speech recognition (no audio reaches Pravaha). Hidden where unsupported. The Permissions-Policy had microphone=(), which would have blocked it everywhere; now microphone=(self).
  • Installable app: manifest, 192/512/maskable PNG icons, shortcuts, and an offline page. The service worker caches one page (/offline) and nothing else, so a deploy can never leave stale code.
  • Hindi punctuation: the Chinese full stop (。) is replaced by the danda (।).
  • Smoke tests: the anonymous-upload check sends well-formed params (the route validates shape first), and the Ask check tolerates two "Source 1" buttons on mobile.

Database

migrations/007_answer_cache.sql (two nullable columns and an index on answers) is already applied to the production database. It is backwards compatible: the code deployed before it keeps working.

Verified

  • 160 unit tests (12 new), typecheck and lint clean.
  • Live DB: three phrasings of one question gave one answer id, 12.1 s then 1.4 s then 0.8 s.
  • Real browser with a simulated recogniser: the spoken question reaches /search and an answer appears; no button without speech support; the bar fits 360 px. Manifest, icons, sw.js headers and /offline checked.

@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pravaha Ready Ready Preview Oct 3, 2026 10:27am UTC

@im-rk
im-rk merged commit d988026 into main Oct 3, 2026
3 checks passed
@im-rk
im-rk deleted the feature/answer-cache-voice-ask-pwa branch October 3, 2026 10:27

This branch was successfully deployed

1 active deployment
Preview — b6a2a343 Deployed Oct 3, 2026 by vercel[bot]
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