Phase 3: Check my work, follow-ups and turn-into-deck

Check my work (third homework mode)
- One model call with its own system prompt marks the student's own
  attempt: verdict, what's right, each issue with why + fix, and the
  corrected version that keeps everything the student got right.
  Unasked-for extras are never errors. The attempt is typed/pasted
  (photos of handwriting are documented as unsupported) and stored in
  the record so Redo re-checks the same work.
- Server: mode "check" + solution on POST /api/homework (zod, 400
  server.needSolution without one) and the same NDJSON stream; new
  checkHomework() pipeline with repair-once validation.

Follow-ups
- New POST /api/homework/refine (plain JSON, RATE_LIMIT_REFINE, zod,
  auth before body): shorter / more detail / explain, plain text back,
  language preserved.
- Shorter + More detail + Original rewrite the finished answer and the
  corrected version in place (FollowUpBar); every guide step has
  Explain step N differently; failed calls say so without losing text.

Turn into a study deck
- Any result hands its content (answer, corrected version or assembled
  guide) to New deck through a one-shot sessionStorage seed with the
  options step pre-filled.

UI
- Phone step 2 gains the third card: tapping it reveals the solution
  field + submit; desktop has three cards and the solution field shows
  with the mode. Homework history labels and share/card previews cover
  the new mode.

Verified: new phase-3 suite 20/20 against a stub Ollama (check payload,
missing-solution 400, refine validation, phone + desktop check flows,
shorter follow-up with restore, guide explain, deck hand-off) plus
regression 74/74, mobile 52/52, declutter 116/116, wizard 80/80,
animation 8/8, native 35/35, phase1 38/38, phase2 43/43, i18n 25/25.
Key parity 734/734. Lint + build clean. SW freezmo-v27.
This commit is contained in:
Martin Dvořák 2026-10-10 14:36:04 +00:00
commit 4513364019
22 changed files with 947 additions and 56 deletions

View file

@ -856,6 +856,33 @@ const en: Record<string, string> = {
"settings.reminderDenied": "Notifications are blocked in your browser settings.",
"settings.reminderError": "Could not set up reminders.",
"library.learningToday": "Today: {n} / {goal}",
/* homework: check my work + follow-ups ----------------------------- */
"homework.mode.check": "Check my work",
"homework.mode.checkDesc": "Mark your own attempt: what's right, what's wrong, and the corrected version.",
"homework.solution.label": "Your solution",
"homework.solution.placeholder": "Paste your own attempt here — the assignment is above.",
"homework.solution.note": "Type or paste your solution as text (photos of handwritten work aren't supported yet).",
"homework.solution.required": "Add your solution so there is something to check.",
"homework.check.title": "Checked",
"homework.check.verdict": "Verdict",
"homework.check.correct": "What's right",
"homework.check.wrong": "What needs fixing",
"homework.check.fix": "Fix",
"homework.check.corrected": "Corrected version",
"homework.history.checked": "Checked",
"homework.loading.checking": "Checking your attempt…",
"homework.followup.shorter": "Shorter",
"homework.followup.more": "More detail",
"homework.followup.explain": "Explain differently",
"homework.followup.redo": "Redo",
"homework.followup.step": "Explain step {n} differently",
"homework.followup.working": "Rewriting…",
"homework.followup.failed": "That didn't work. Try again.",
"homework.followup.restore": "Original",
"homework.toDeck": "Turn into a study deck",
"homework.toDeckNote": "Opens New deck with this content and the options pre-filled.",
"server.needSolution": "Add your own solution so it can be checked.",
"doc.readingPage": "Reading page {n} of {total}…",
"doc.readingWord": "Reading the Word document…",
"doc.readingSlides": "Reading the slides…",
@ -1658,6 +1685,33 @@ const cs: Record<string, string> = {
"settings.reminderDenied": "Oznámení jsou v nastavení prohlížeče zablokovaná.",
"settings.reminderError": "Připomínky se nepodařilo nastavit.",
"library.learningToday": "Dnes: {n} / {goal}",
/* homework: check my work + follow-ups ----------------------------- */
"homework.mode.check": "Zkontrolovat moje řešení",
"homework.mode.checkDesc": "Oznámkuj svůj postup: co je správně, co špatně a opravená verze.",
"homework.solution.label": "Tvoje řešení",
"homework.solution.placeholder": "Sem vlož svůj postup — zadání je nahoře.",
"homework.solution.note": "Řešení napiš nebo vlož jako text (fotky ručně psaného postupu zatím nejdou).",
"homework.solution.required": "Přidej svoje řešení, ať je co zkontrolovat.",
"homework.check.title": "Zkontrolováno",
"homework.check.verdict": "Hodnocení",
"homework.check.correct": "Co je správně",
"homework.check.wrong": "Co opravit",
"homework.check.fix": "Oprava",
"homework.check.corrected": "Opravená verze",
"homework.history.checked": "Zkontrolováno",
"homework.loading.checking": "Kontroluji tvůj postup…",
"homework.followup.shorter": "Kratší",
"homework.followup.more": "Více detailů",
"homework.followup.explain": "Vysvětlit jinak",
"homework.followup.redo": "Znovu",
"homework.followup.step": "Vysvětlit krok {n} jinak",
"homework.followup.working": "Přepisuji…",
"homework.followup.failed": "Nepovedlo se. Zkus to znovu.",
"homework.followup.restore": "Původní",
"homework.toDeck": "Převést na studijní sadu",
"homework.toDeckNote": "Otevře Novou sadu s tímto obsahem a předvyplněnými možnostmi.",
"server.needSolution": "Přidej svoje řešení, ať se dá zkontrolovat.",
"doc.readingPage": "Čtu stranu {n} z {total}…",
"doc.readingWord": "Čtu dokument Word…",
"doc.readingSlides": "Čtu snímky…",