feat: add AI Training Mode with Bedrock exercise generation#31
Open
kiro-agent[bot] wants to merge 6 commits intomainfrom
Open
feat: add AI Training Mode with Bedrock exercise generation#31kiro-agent[bot] wants to merge 6 commits intomainfrom
kiro-agent[bot] wants to merge 6 commits intomainfrom
Conversation
…tion - Add 'AI_TRAINING' to TrainingMode union type in Training.ts - Add AIExercise interface with prompt, options, correctOptionIndex, exerciseType, and sourceWord fields - Add optional aiExercises field to TrainingExecution interface - Add AI_TRAINING to TrainingMode enum in GraphQL schema - Add AIExercise type to GraphQL schema - Add aiExercises field to TrainingExecution GraphQL type - Add generateExercises method to AIService with rate limiting, Bedrock integration, and response validation - Extract parseAndValidateExercises as a separate testable method Co-authored-by: Johannes Koch <github@lockhead.net>
…rt, and answer submission Co-authored-by: Johannes Koch <github@lockhead.net>
- ai-service.test.ts: unit tests for parseAndValidateExercises (valid, invalid, markdown fences, invalid JSON, all-invalid) and generateExercises (Bedrock failure, rate limit, empty words, logging, invalid JSON, all-invalid) - ai-service.property.test.ts: property tests for prompt construction (all words and languages included), parsing validation (only valid exercises returned), and round-trip serialization (JSON.stringify/parse equivalence) Co-authored-by: Johannes Koch <github@lockhead.net>
…etion Co-authored-by: Johannes Koch <github@lockhead.net>
… and backward compatibility Co-authored-by: Johannes Koch <github@lockhead.net>
…nd mode selection Co-authored-by: Johannes Koch <github@lockhead.net>
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.
This pull request was generated by @kiro-agent 👻
Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent
Summary
Implements the full AI Training Mode feature as specified in
.kiro/specs/ai-training-mode/. This adds a newAI_TRAININGmode that uses Amazon Bedrock to generate contextual language exercises (fill-in-the-blank, verb conjugation, preposition selection, sentence completion) based on selected vocabulary words.Changes
Backend - Domain Model & GraphQL Schema
TrainingModetype with'AI_TRAINING'valueAIExerciseinterface (prompt, options, correctOptionIndex, exerciseType, sourceWord)aiExercises?: AIExercise[]toTrainingExecutionAI_TRAININGenum value,AIExercisetype, andaiExercisesfield onTrainingExecutionBackend - AI Service (
ai-service.ts)generateExercises()method: builds structured Bedrock prompt, calls InvokeModelCommand, parses and validates responseparseAndValidateExercises()with graceful degradation (filters out invalid exercises, logs warnings)Backend - Training Service (
training-service.ts)createTraining: acceptsAI_TRAININGmode (static and randomized)startTraining: new AI_TRAINING branch - selects words, fetches full word details + language info, calls AIService.generateExercises, stores aiExercises on executionsubmitAnswer: new AI_TRAINING branch - compares selected option index against correctOptionIndex, tracks completionFrontend - Flutter
training_provider.dartto fetchaiExercisesfields in GraphQL mutationsChoiceChipintraining_creation_screen.dartai_exercise_widget.dart- displays exercise type, prompt, answer options as tappable buttons, correct/incorrect feedbacktraining_execution_screen.dartto handle AI_TRAINING mode with progress trackingTests
ai-service.test.ts- 11 unit tests covering exercise generation, rate limiting, error handling, parsingai-service.property.test.ts- Property tests for prompt construction, parsing/validation, round-trip serializationai-training-service.test.ts- 7 unit tests for AI training creation, start, submission, completionai-training-service.property.test.ts- 4 property tests for creation, start, submission, backward compatibilityAll 28 tasks completed
All tasks from
.kiro/specs/ai-training-mode/tasks.mdhave been implemented and marked as complete.Notes
npm testlocally to verify