Skip to content

test: AI Features — Aristotle tutor, AI grading pipeline, voice & video exercises #299

Description

@guillermoscript

Scope

All AI-powered features: Aristotle course tutor, AI auto-grading for exercises/exams, voice exercises, and video exercises. These require an OpenAI API key with credits in .env.local.

Prerequisites

  • OPENAI_API_KEY set and funded in .env.local
  • Course with course_ai_tutors row: enabled = true
  • Course must have lessons, exercises, exams

Personas

Persona Email Role
Student student@e2etest.com student (Default School)
Teacher owner@e2etest.com admin/teacher (Default School)

AI Components

Aristotle Tutor (/dashboard/student/courses/[courseId]/lessons/[lessonId])

  • Floating chat panel visible when course_ai_tutors.enabled = true
  • Sends first message → receives streaming response
  • Tutor context includes correct lesson title and course structure
  • Tutor knows student's completion status (which lessons done, exam scores)
  • Pass/fail check uses 70% threshold (not passing_score column — that doesn't exist)
  • Session created in aristotle_sessions table
  • Messages saved to aristotle_messages table (both user + assistant)
  • Past session summaries included in subsequent sessions
  • Tutor stays on-topic — off-topic question redirected to course material
  • No chat panel when course_ai_tutors.enabled = false

AI Exercise Grading (/dashboard/student/courses/[courseId]/exercises/[exerciseId])

Exercise types that use AI grading:

  • free_text — open-ended text answer

  • voice — audio transcription + evaluation

  • video — camera recording + evaluation

  • Submit free-text answer → AI evaluates, returns score + feedback

  • Feedback rendered as markdown in results view

  • Score saved to exercise_completions table

  • XP awarded after submission (check xp_transactions row created)

  • Resubmission: new exercise_completions row created (not overwrite)

  • Teacher can view AI feedback in teacher submissions view

Voice Exercises (plan-gated: pro+)

  • Plan gate: voice exercise shows upgrade prompt on free / starter plan
  • pro+ plan: microphone permission requested
  • Record audio → transcribed → AI evaluates
  • Playback of recorded audio before submit
  • Submit → score + feedback returned

Video Exercises (new feature — VideoExercise component)

  • Camera permission requested
  • Record video → saved
  • Submit → AI evaluates
  • Plan gate: same as voice (requires pro+)

AI Exam Grading (/dashboard/teacher/courses/[courseId]/exams/[examId]/submissions/[submissionId])

  • After student submits exam, AI-graded submissions appear in teacher view
  • Teacher can override individual question score
  • Teacher can override overall score
  • Save override → updates exam_submissions record
  • Student score in progress page reflects teacher override

Known Issues (pre-confirmed fixed)

  • exams.passing_score column does not exist — all pass logic uses hardcoded 70% threshold
  • lesson_completions has no tenant_id — removed from Aristotle route query
  • exercise_completions has no tenant_id — removed from Aristotle route query

Definition of Done

  • Aristotle streams responses with correct course context
  • AI grading returns score + feedback for all exercise types
  • XP awarded on completion
  • Teacher override saves and reflects to student
  • All AI calls use model from AI_MODELS config (not hardcoded)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions