Files
maternal-app/maternal-web/lib/api/voice.ts
Andrei e94a1018c4
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
Add voice command review/edit system with user feedback tracking
Implemented complete review/edit workflow for voice commands with ML feedback collection:

**Backend:**
- Created V012 migration for voice_feedback table with user action tracking
- Added VoiceFeedback entity with approval/edit/reject actions
- Implemented voice feedback API endpoint (POST /api/v1/voice/feedback)
- Fixed user ID extraction bug (req.user.userId vs req.user.sub)

**Frontend:**
- Built VoiceActivityReview component with field-specific editors
- Integrated review dialog into voice command workflow
- Added approve/edit/reject handlers with feedback submission
- Fixed infinite loop by tracking processed classification IDs

**Features:**
- Users can review AI-extracted data before saving
- Quick-edit capabilities for all activity fields
- Feedback data stored for ML model improvement
- Activity creation only happens after user approval/edit

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 11:03:54 +00:00

23 lines
571 B
TypeScript

import apiClient from './client';
export interface VoiceFeedbackData {
childId?: string;
activityId?: string;
transcript: string;
language?: string;
extractedType: string;
extractedData: Record<string, any>;
confidence?: number;
action: 'approved' | 'edited' | 'rejected';
finalType?: string;
finalData?: Record<string, any>;
userNotes?: string;
}
export const voiceApi = {
async saveFeedback(feedbackData: VoiceFeedbackData) {
const response = await apiClient.post('/api/v1/voice/feedback', feedbackData);
return response.data;
},
};