Open
Conversation
models.py (line 541) FillApplicationFormRequest now uses only questions (no form_fields). Added model_config = ConfigDict(extra="forbid") at models.py (line 543) so legacy payload keys like form_fields are rejected. models.py (line 568) FillApplicationFormResponse now matches new contract: question_id field_id field_ids question answer confidence (float) sources (list of strings) via FilledQuestionAnswer at models.py (line 571). Updated endpoint handler/service logic router.py (line 599) Rewrote fill_application_form to process one logical question at a time. Uses prompt, question_type, options, profile data, and job context (QuestionContext) for QA fallback. Type-specific rules implemented in _normalize_answer_for_type: single_choice at router.py (line 805) multi_choice at router.py (line 810) free_text default path in the same normalizer date at router.py (line 800) (normalized to YYYY-MM-DD) boolean at router.py (line 795) (true / false) file at router.py (line 793) (manual upload placeholder) Optional questions: If insufficient context, returns low-confidence empty answer with explicit source tags like insufficient_context_optional, without failing the request. Confidence: Per-answer confidence preserved and clamped 0..1. Overall confidence is averaged at router.py (line 885).
In router.py: Added: from sqlalchemy.exc import IntegrityError In /auth/register: After db.add(user), added await db.flush() so flash_users row is inserted before token insert. Added except IntegrityError with rollback and clearer 400 response. In /auth/login: Added await db.flush() before commit after adding refresh token. Added except IntegrityError with rollback and clearer error. Why this fixes your error Your failure was FK violation on flash_refresh_tokens.user_id -> flash_users.id. flush() forces SQLAlchemy to execute pending INSERTs in dependency order before commit, so the user row exists before token row validation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FillApplicationFormRequest now uses only questions (no form_fields). Added model_config = ConfigDict(extra="forbid") at models.py so legacy payload keys like form_fields are rejected. models.py
FillApplicationFormResponse now matches new contract: question_id
field_id
field_ids
question
answer
confidence (float)
sources (list of strings)
via FilledQuestionAnswer at models.py
Updated endpoint handler/service logic
router.py
Rewrote fill_application_form to process one logical question at a time. Uses prompt, question_type, options, profile data, and job context (QuestionContext) for QA fallback. Type-specific rules implemented in _normalize_answer_for_type: single_choice at router.py
multi_choice at router.py
free_text default path in the same normalizer
date at router.py (line 800) (normalized to YYYY-MM-DD) boolean at router.py (true / false)
file at router.py (line 793) (manual upload placeholder) Optional questions:
If insufficient context, returns low-confidence empty answer with explicit source tags like insufficient_context_optional, without failing the request. Confidence:
Per-answer confidence preserved and clamped 0..1.
Overall confidence is averaged at router.py