Changes to endpoints so they allow to only get context and then the exercises as well as tidying up a bit
This commit is contained in:
@@ -4,6 +4,7 @@ from .writing import IWritingService
|
||||
from .speaking import ISpeakingService
|
||||
from .reading import IReadingService
|
||||
from .grade import IGradeService
|
||||
from .exercises import IExerciseService
|
||||
|
||||
__all__ = [
|
||||
"ILevelService",
|
||||
@@ -12,4 +13,5 @@ __all__ = [
|
||||
"ISpeakingService",
|
||||
"IReadingService",
|
||||
"IGradeService",
|
||||
"IExerciseService"
|
||||
]
|
||||
|
||||
33
app/services/abc/exam/exercises.py
Normal file
33
app/services/abc/exam/exercises.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Dict, Any
|
||||
|
||||
|
||||
class IExerciseService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def generate_multiple_choice(self, args: Dict, exercise_id: int) -> Dict[str, Any]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def generate_blank_space_text(self, args: Dict, exercise_id: int) -> Dict[str, Any]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def generate_reading_passage_utas(self, args: Dict, exercise_id: int) -> Dict[str, Any]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def generate_writing_task(self, args: Dict, exercise_id: int) -> Dict[str, Any]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def generate_speaking_task(self, args: Dict, exercise_id: int) -> Dict[str, Any]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def generate_reading_task(self, args: Dict, exercise_id: int) -> Dict[str, Any]:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def generate_listening_task(self, args: Dict, exercise_id: int) -> Dict[str, Any]:
|
||||
pass
|
||||
@@ -1,7 +1,7 @@
|
||||
from abc import ABC, abstractmethod
|
||||
import random
|
||||
|
||||
from typing import Dict
|
||||
from typing import Dict, Optional
|
||||
|
||||
from fastapi import UploadFile
|
||||
|
||||
@@ -10,6 +10,10 @@ from app.configs.constants import EducationalContent
|
||||
|
||||
class ILevelService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def generate_exercises(self, dto):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def get_level_exam(
|
||||
self, number_of_exercises: int = 25, min_timer: int = 25, diagnostic: bool = False
|
||||
@@ -30,18 +34,18 @@ class ILevelService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def gen_multiple_choice(
|
||||
self, mc_variant: str, quantity: int, start_id: int = 1, *, utas: bool = False, all_exams=None
|
||||
self, mc_variant: str, quantity: int, start_id: int = 1 #, *, utas: bool = False, all_exams=None
|
||||
):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def gen_blank_space_text_utas(
|
||||
self, quantity: int, start_id: int, size: int, topic=random.choice(EducationalContent.MTI_TOPICS)
|
||||
self, quantity: int, start_id: int, size: int, topic: str
|
||||
):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def gen_reading_passage_utas(
|
||||
self, start_id, sa_quantity: int, mc_quantity: int, topic=random.choice(EducationalContent.MTI_TOPICS)
|
||||
self, start_id, mc_quantity: int, topic: Optional[str] #sa_quantity: int,
|
||||
):
|
||||
pass
|
||||
|
||||
@@ -3,14 +3,21 @@ from abc import ABC, abstractmethod
|
||||
from queue import Queue
|
||||
from typing import Dict, List
|
||||
|
||||
from fastapi import UploadFile
|
||||
|
||||
|
||||
class IListeningService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def get_listening_question(
|
||||
self, section_id: int, topic: str, req_exercises: List[str], difficulty: str,
|
||||
number_of_exercises_q=queue.Queue(), start_id=-1
|
||||
):
|
||||
async def generate_listening_dialog( self, section_id: int, topic: str, difficulty: str):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def get_listening_question(self, section: int, dto):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def get_dialog_from_audio(self, upload: UploadFile):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from queue import Queue
|
||||
from typing import List
|
||||
from fastapi import UploadFile
|
||||
|
||||
|
||||
class IReadingService(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def gen_reading_passage(
|
||||
self,
|
||||
passage_id: int,
|
||||
topic: str,
|
||||
req_exercises: List[str],
|
||||
number_of_exercises_q: Queue,
|
||||
difficulty: str,
|
||||
start_id: int
|
||||
):
|
||||
async def import_exam(self, exercises: UploadFile, solutions: UploadFile = None):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def generate_reading_exercises(self, dto):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from app.configs.constants import AvatarEnum
|
||||
|
||||
|
||||
class IVideoGeneratorService(ABC):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user