ENCOA-311
This commit is contained in:
@@ -7,6 +7,7 @@ from ielts_be.configs.constants import GPTModels, FieldsAndExercises, Temperatur
|
||||
from ielts_be.dtos.reading import ReadingDTO
|
||||
from ielts_be.helpers import ExercisesHelper
|
||||
from ielts_be.services import IReadingService, ILLMService
|
||||
from ielts_be.utils import pick_difficulty
|
||||
from .fill_blanks import FillBlanks
|
||||
from .idea_match import IdeaMatch
|
||||
from .paragraph_match import ParagraphMatch
|
||||
@@ -84,6 +85,7 @@ class ReadingService(IReadingService):
|
||||
question = await self._fill_blanks.gen_summary_fill_blanks_exercise(
|
||||
text, req_exercise.quantity, start_id, difficulty, req_exercise.num_random_words
|
||||
)
|
||||
question["difficulty"] = difficulty
|
||||
self._logger.info(f"Added fill blanks: {question}")
|
||||
return question
|
||||
|
||||
@@ -91,6 +93,7 @@ class ReadingService(IReadingService):
|
||||
question = await self._true_false.gen_true_false_not_given_exercise(
|
||||
text, req_exercise.quantity, start_id, difficulty, "reading"
|
||||
)
|
||||
question["difficulty"] = difficulty
|
||||
self._logger.info(f"Added trueFalse: {question}")
|
||||
return question
|
||||
|
||||
@@ -100,6 +103,7 @@ class ReadingService(IReadingService):
|
||||
)
|
||||
|
||||
if ExercisesHelper.answer_word_limit_ok(question):
|
||||
question["difficulty"] = difficulty
|
||||
self._logger.info(f"Added write blanks: {question}")
|
||||
return question
|
||||
else:
|
||||
@@ -110,6 +114,7 @@ class ReadingService(IReadingService):
|
||||
question = await self._paragraph_match.gen_paragraph_match_exercise(
|
||||
text, req_exercise.quantity, start_id
|
||||
)
|
||||
question["difficulty"] = difficulty
|
||||
self._logger.info(f"Added paragraph match: {question}")
|
||||
return question
|
||||
|
||||
@@ -118,12 +123,14 @@ class ReadingService(IReadingService):
|
||||
text, req_exercise.quantity, start_id
|
||||
)
|
||||
question["variant"] = "ideaMatch"
|
||||
question["difficulty"] = difficulty
|
||||
self._logger.info(f"Added idea match: {question}")
|
||||
return question
|
||||
elif req_exercise.type == "multipleChoice":
|
||||
question = await self._multiple_choice.gen_multiple_choice(
|
||||
text, req_exercise.quantity, start_id, difficulty, 4
|
||||
)
|
||||
question["difficulty"] = difficulty
|
||||
self._logger.info(f"Added multiple choice: {question}")
|
||||
return question
|
||||
|
||||
@@ -137,7 +144,7 @@ class ReadingService(IReadingService):
|
||||
req_exercise,
|
||||
dto.text,
|
||||
start_id,
|
||||
dto.difficulty
|
||||
pick_difficulty(req_exercise.difficulty, dto.difficulty)
|
||||
)
|
||||
)
|
||||
start_id += req_exercise.quantity
|
||||
|
||||
Reference in New Issue
Block a user