Skip to content

feat(lessons): Mount AI teaching assistant on lesson pages#1167

Open
jeromehardaway wants to merge 1 commit into
masterfrom
feat/1152-mount-ai-teaching-assistant
Open

feat(lessons): Mount AI teaching assistant on lesson pages#1167
jeromehardaway wants to merge 1 commit into
masterfrom
feat/1152-mount-ai-teaching-assistant

Conversation

@jeromehardaway

Copy link
Copy Markdown
Contributor

Problem

src/components/ai-assistant/AITeachingAssistant.tsx is a complete chat modal (message history, lesson-context awareness, feedback via /api/j0di3/learning/feedback, ESC-to-close) exported from src/components/ai-assistant/index.ts, but it had zero imports anywhere — students had no way to reach it. The backend /api/j0di3/learning/explain proxy is live and already used elsewhere.

Solution

  • Mounted AITeachingAssistant on the lesson page (src/pages/lessons/lesson/[id].tsx) with a floating "Ask J0d!e" button (fixed bottom-right, navy/gold brand tokens, tw- prefixed classes).
  • The assistant receives the current lesson as context (lessonId, lessonTitle, Module N, course title, lesson body) once the lesson loads; it still opens without context while loading.
  • Verified the endpoints the component calls exist: src/pages/api/j0di3/learning/explain.ts and src/pages/api/j0di3/learning/feedback.ts (both j0di3Proxy routes).
  • Added a smoke test (__tests__/pages/lessons/lesson.test.tsx, mocked fetch/router/next-auth): floating button renders, opens the assistant with lesson context, sending a question renders a mocked response with the lesson title as concept, and the error state renders on API failure.

Follow-ups (intentionally out of scope)

  • Challenge page (src/pages/challenges/[id].tsx): not mounted — it already has a dedicated coach UI (/api/j0di3/challenges/{id}/coach) that sends the student's code as context; adding the generic assistant alongside would duplicate the chat UX without code awareness. Worth a separate design pass.
  • Global Cmd+K / "A" shortcut affordance to open the assistant from anywhere.

Verification

  • npm run typecheck — 7 pre-existing errors in unrelated __tests__/{lib,pages/api}/j0di3/* files (present on master from feat: Integrate J0dI3 AI backend across 5 pillars #1026); no new errors from this change.
  • npm run lint — 25 pre-existing errors, identical count on master; changed files lint clean (npx biome lint exits 0 on both).
  • npm test — 42 files, 388 tests, all pass (includes the 4 new lesson-page tests).
  • npm run build — succeeds; /lessons/lesson/[id] compiles.

Closes #1152

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
vets-who-code-app Ready Ready Preview, Comment Jun 11, 2026 4:52pm

Request Review

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.

Mount the built-but-unused AITeachingAssistant into lesson and challenge pages

1 participant