Remove unnecessary section id's from reading and listening to retrieve questions since context is already on the post dto

This commit is contained in:
Carlos-Mesquita
2024-11-12 14:19:52 +00:00
parent 12b3c45173
commit 6daab0d9a7
8 changed files with 13 additions and 15 deletions

View File

@@ -13,7 +13,7 @@ class IListeningService(ABC):
pass
@abstractmethod
async def get_listening_question(self, section: int, dto):
async def get_listening_question(self, dto):
pass
@abstractmethod

View File

@@ -92,6 +92,7 @@ class ListeningService(IListeningService):
async def generate_listening_dialog(self, section: int, topic: str, difficulty: str):
return await self._sections[f'section_{section}']["generate_dialogue"](section, topic)
# TODO: When mp3 editor
async def get_dialog_from_audio(self, upload: UploadFile):
ext, path_id = await FileHelper.save_upload(upload)
dialog = await self._stt.speech_to_text(f'./tmp/{path_id}/upload.{ext}')
@@ -100,8 +101,7 @@ class ListeningService(IListeningService):
async def generate_mp3(self, dto: Dialog) -> bytes:
return await self._tts.text_to_speech(dto)
async def get_listening_question(self, section: int, dto: GenerateListeningExercises):
dialog_type = self._sections[f'section_{section}']["type"]
async def get_listening_question(self, dto: GenerateListeningExercises):
start_id = 1
exercise_tasks = []
@@ -109,7 +109,7 @@ class ListeningService(IListeningService):
exercise_tasks.append(
self._generate_exercise(
req_exercise,
dialog_type,
"dialog or monologue",
dto.text,
start_id,
dto.difficulty