Skip to content

Fix hints generation robustness and HokieBird activity UX#436

Open
Arnav2525 wants to merge 4 commits into
mainfrom
fix/hints-and-hokiebird-ux
Open

Fix hints generation robustness and HokieBird activity UX#436
Arnav2525 wants to merge 4 commits into
mainfrom
fix/hints-and-hokiebird-ux

Conversation

@Arnav2525
Copy link
Copy Markdown
Collaborator

Summary

This PR improves hint generation reliability/quality and fixes HokieBird maze UX regressions.

Problem

  • Hints could appear stuck on "Generating hints..." on some pages.
  • Some generated hints were low-quality (e.g. included "No question found").
  • In HokieBird maze activity:
    • students had to use Reset All after one mistake,
    • drag/drop was disabled on some pages due to inconsistent props.draggable values.

What Changed

Backend (backend/src/routers/pages.py)

  • Improved hint input extraction in create_page_with_gpt:
    • question now falls back across:
      1. props.question
      2. page.questions[0].question
      3. question-like line from page.content
  • Added answer/options fallback from page.questions when props.answers is missing.
  • Detects stale cached hints containing "no question found" and regenerates them.
  • Improved DEV_MODE mock hints to avoid placeholder garbage text when question is missing.

Frontend (frontend/src/pages/BookPage.tsx)

  • Hardened getAllHints():
    • added timeout (Promise.race with 12s timeout),
    • added fallback hints for timeout/error/parse failures/empty results,
    • ensures loading state clears reliably.
  • Help me now opens hints window immediately (interaction logging is non-blocking).

Frontend (frontend/src/components/HokieBirdMap.tsx)

  • Added per-slot clear action (×) so a single incorrect block can be removed.
  • Restored reliable drag/drop:
    • action chips always draggable,
    • drop handlers attached on target input/container for consistent drops.
  • Kept click-to-fill behavior and Reset All.

User Impact

  • Hint generation is more robust and context-aware on production pages.
  • Students no longer get stuck with unusable "No question found" hints.
  • Maze activity is less frustrating:
    • can clear one block instead of restarting whole sequence,
    • drag/drop works consistently.

Verification

  • Frontend typecheck passes: npx tsc --noEmit
  • Manual validation:
    • hints endpoint returns contextual hints on real dataset pages,
    • stale bad hints are regenerated,
    • single-block clear and drag/drop work in HokieBird maze.

Files Changed

  • backend/src/routers/pages.py
  • frontend/src/pages/BookPage.tsx
  • frontend/src/components/HokieBirdMap.tsx

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.

3 participants