Skip to content

feat(api): Interactive Voice Feedback Loop for Missing Incident Data (#106)#200

Open
Gopisokk wants to merge 1 commit intofireform-core:mainfrom
Gopisokk:feat/interactive-feedback-loop
Open

feat(api): Interactive Voice Feedback Loop for Missing Incident Data (#106)#200
Gopisokk wants to merge 1 commit intofireform-core:mainfrom
Gopisokk:feat/interactive-feedback-loop

Conversation

@Gopisokk
Copy link

@Gopisokk Gopisokk commented Mar 7, 2026

Summary

Resolves #[Paste Issue 106 number here] by implementing a stateful, multi-turn feedback loop for form submissions. If the LLM extraction identifies missing required data, the pipeline pauses, saves the partial JSON state, and exposes the missing fields to the frontend so it can prompt the user.

Architecture Changes

  • Database: Upgraded FormSubmission with status: str, extracted_data: JSON, and missing_fields: JSON to persist partial states.
  • Core Logic: Completely decoupled LLM.main_loop() from Filler.fill_form() in src/file_manipulator.py to allow execution to pause without generating a PDF. Wait states are now supported.
  • API Extensibility: Added a new endpoint POST /forms/{id}/feedback. This receives subsequent user input targeting only the missing fields, merging the newly extracted data with the previous session. The final PDF is generated only when all fields are successfully mapped.

Testing

  • Automated PyTest integration test added in tests/test_forms.py covering the end-to-end multi-turn feedback behavior, LLM mocking, and model DB interactions.

Note: Since the DB schema for FormSubmission was altered (SQLModel), maintainers need to recreate the fireform.db SQLite file locally or the application will throw a missing column exception on startup.

…ireform-core#106)

Implemented stateful forms to support iterative data collection:
- FormSubmission now stores status, extracted_data, and missing_fields
- Decoupled LLM.main_loop() extraction from Filler.fill_form() to allow partial states
- POST /forms/fill now checks for missing fields. Returns status: missing_data and pauses execution if data is incomplete.
- Added POST /forms/{id}/feedback endpoint to accept follow-up user input, targeting only the previously missing_fields.
- Generates the final PDF only when all fields are successfully extracted and status: completed.
- Added mock-driven integration tests for the feedback loop flow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant