feat: add sum with image reference problem

This commit is contained in:
AlanSilvaaa
2026-05-26 11:56:41 -04:00
parent 29754b4782
commit c2613cb35e
6 changed files with 289 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ from app.problems.grade_1.compose_and_decompose_numbers import (
from app.problems.grade_1.join_pictures_with_quantity import (
join_pictures_with_quantity,
)
from app.problems.grade_1.sum_with_image_reference import sum_with_image_reference
from app.problems.grade_1.where_are_more_items import where_are_more_items
from app.schemas.grade_1.compose_and_decompose_numbers import (
ComposeAndDecomposeNumbersProblem,
@@ -15,6 +16,10 @@ from app.schemas.grade_1.join_pictures_with_quantity import (
JoinPicturesWithQuantityProblem,
JoinPicturesWithQuantityRequest,
)
from app.schemas.grade_1.sum_with_image_reference import (
SumWithImageReferenceProblem,
SumWithImageReferenceRequest,
)
from app.schemas.grade_1.where_are_more_items import (
WhereAreMoreItemsProblem,
WhereAreMoreItemsRequest,
@@ -62,6 +67,31 @@ def create_join_pictures_with_quantity_problem(
raise HTTPException(status_code=400, detail=str(exc)) from exc
@router.post(
"/sum_with_image_reference",
response_model=SumWithImageReferenceProblem,
)
def create_sum_with_image_reference_problem(
request: SumWithImageReferenceRequest,
) -> dict:
try:
return sum_with_image_reference(
first_quantity=request.first_quantity,
second_quantity=request.second_quantity,
first_description=request.first_description,
second_description=request.second_description,
common_object=request.common_object,
first_picture=request.first_picture.model_dump(),
second_picture=request.second_picture.model_dump(),
option_count=request.option_count,
min_option_quantity=request.min_option_quantity,
max_option_quantity=request.max_option_quantity,
seed=request.seed,
)
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc)) from exc
@router.post(
"/where_are_more_items",
response_model=WhereAreMoreItemsProblem,