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>
This commit is contained in:
22
maternal-web/lib/api/voice.ts
Normal file
22
maternal-web/lib/api/voice.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
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;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user