Fix voice command data structure and prevent duplicate activities
Backend changes: - Update LLM prompt to use correct field names matching frontend interfaces - Use 'diaperType' instead of 'type' for diaper activities - Use 'feedingType' instead of 'method' for feeding activities - Simplify sleep structure (duration, quality, location only) Frontend changes: - Add processedClassificationId tracking to prevent infinite loop - Create unique ID for each classification to avoid duplicate processing - Reset processed ID when dialog opens/closes or new recording starts This fixes the issue where voice commands created multiple duplicate activities and had mismatched data structures causing tracker warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -172,23 +172,21 @@ Extract activity details from the user's text and respond ONLY with valid JSON (
|
||||
"timestamp": "ISO 8601 datetime if mentioned (e.g., '3pm', '30 minutes ago'), otherwise use current time",
|
||||
"details": {
|
||||
// For feeding:
|
||||
"feedingType": "bottle|breast|solids",
|
||||
"amount": number or null,
|
||||
"unit": "ml|oz" or null,
|
||||
"method": "bottle|breast|solids" or null,
|
||||
"side": "left|right|both" or null,
|
||||
"side": "left|right|both" or null (for breastfeeding only),
|
||||
"duration": number (minutes) or null,
|
||||
"notes": string or null
|
||||
|
||||
// For sleep:
|
||||
"start_time": "ISO 8601" or null,
|
||||
"end_time": "ISO 8601" or null,
|
||||
"quality": "peaceful|restless|fussy",
|
||||
"location": "crib|bassinet|arms|bed|stroller|car seat",
|
||||
"duration": number (minutes) or null,
|
||||
"quality": "peaceful|restless|fussy" or null,
|
||||
"location": string or null,
|
||||
"notes": string or null
|
||||
|
||||
// For diaper:
|
||||
"type": "wet|dirty|both",
|
||||
"diaperType": "wet|dirty|both",
|
||||
"color": string or null,
|
||||
"consistency": string or null,
|
||||
"rash": boolean or null,
|
||||
|
||||
Reference in New Issue
Block a user