feat(lessons): Mount AI teaching assistant on lesson pages#1167
Open
jeromehardaway wants to merge 1 commit into
Open
feat(lessons): Mount AI teaching assistant on lesson pages#1167jeromehardaway wants to merge 1 commit into
jeromehardaway wants to merge 1 commit into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
src/components/ai-assistant/AITeachingAssistant.tsxis a complete chat modal (message history, lesson-context awareness, feedback via/api/j0di3/learning/feedback, ESC-to-close) exported fromsrc/components/ai-assistant/index.ts, but it had zero imports anywhere — students had no way to reach it. The backend/api/j0di3/learning/explainproxy is live and already used elsewhere.Solution
AITeachingAssistanton 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).lessonId,lessonTitle,Module N, course title, lesson body) once the lesson loads; it still opens without context while loading.src/pages/api/j0di3/learning/explain.tsandsrc/pages/api/j0di3/learning/feedback.ts(bothj0di3Proxyroutes).__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 asconcept, and the error state renders on API failure.Follow-ups (intentionally out of scope)
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.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 lintexits 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