Files
soroban-abacus-flashcards/apps/web/drizzle/0015_early_pepper_potts.sql
Thomas Hallock 2d33f35c4d fix: correct GPT-5 API parameters and surface actual grading errors
Two critical fixes for worksheet grading:

1. **Fix OpenAI Responses API parameters**
   - Move `verbosity` from top-level to `text.verbosity`
   - API was rejecting requests with 400 error
   - Confirmed against GPT-5 Responses API documentation

2. **Surface actual grading errors in UI**
   - Add `error_message` column to worksheet_attempts table
   - Store actual API/grading errors in database
   - Display real error messages instead of generic "too blurry" text
   - Users now see OpenAI API errors, validation failures, etc.

Changes:
- Updated gradeWorksheet.ts API call structure
- Created migration 0020 for error_message column
- Updated processAttempt.ts to save error messages
- Updated API route to return errorMessage field
- Updated results page to display actual errors

Now when grading fails, users see helpful error messages like:
"Unsupported parameter: 'verbosity'..." instead of just "too blurry"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 06:12:10 -06:00

5 lines
688 B
SQL

-- Custom SQL migration file, put your code below! --
CREATE TABLE `worksheet_mastery` (`id` text PRIMARY KEY NOT NULL, `user_id` text NOT NULL, `skill_id` text NOT NULL, `is_mastered` integer DEFAULT 0 NOT NULL, `total_attempts` integer DEFAULT 0 NOT NULL, `correct_attempts` integer DEFAULT 0 NOT NULL, `last_accuracy` real, `first_attempt_at` integer, `mastered_at` integer, `last_practiced_at` integer NOT NULL, `updated_at` integer NOT NULL, `created_at` integer NOT NULL, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade);
--> statement-breakpoint
CREATE INDEX `worksheet_mastery_user_skill_idx` ON `worksheet_mastery` (`user_id`, `skill_id`);