Files
aiform_prod/frontend
AI Assistant 1789dafce2 fix: Improve problem_description detection for draft completeness check
Problem:
- problem_description not found in payload, but exists in draft list
- Completeness check fails because hasDescription = false
- Draft not recognized as ready for confirmation

Solution:
1. Enhanced problem_description extraction:
   - Checks multiple locations: body.problem_description, payload.problem_description
   - Also checks payload.body.problem_description for nested structures
   - Added fallback to body.description and payload.description

2. Improved completeness logic:
   - If problem_description not found but wizard_plan and answers exist,
     infer that description was entered (plan is generated from description)
   - This handles cases where description exists but not in expected payload location

3. Better logging:
   - Shows if problem_description was found directly or inferred
   - Logs all payload keys for debugging

Logic:
- hasDescription = !!problemDescription || (!!wizardPlan && !!answers)
- If plan and answers exist → description was entered earlier
- This allows drafts with plan+answers+documents to proceed to confirmation

Files:
- frontend/src/pages/ClaimForm.tsx: Enhanced problem_description detection
2025-11-24 15:12:29 +03:00
..