ENCOA-311
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List
|
||||
|
||||
from fastapi import UploadFile
|
||||
|
||||
@@ -10,7 +11,7 @@ class IListeningController(ABC):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def generate_listening_dialog(self, section_id: int, topic: str, difficulty: str):
|
||||
async def generate_listening_dialog(self, section_id: int, topic: str, difficulty: List[str]):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List
|
||||
|
||||
|
||||
class ISpeakingController(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def get_speaking_part(self, task: int, topic: str, second_topic: str, difficulty: str):
|
||||
async def get_speaking_part(self, task: int, topic: str, second_topic: str, difficulty: List[str]):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List
|
||||
|
||||
from fastapi.datastructures import UploadFile
|
||||
|
||||
@@ -6,9 +7,9 @@ from fastapi.datastructures import UploadFile
|
||||
class IWritingController(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def get_writing_task_general_question(self, task: int, topic: str, difficulty: str):
|
||||
async def get_writing_task_general_question(self, task: int, topic: str, difficulty: List[str]):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def get_writing_task_academic_question(self, task: int, attachment: UploadFile, difficulty: str):
|
||||
async def get_writing_task_academic_question(self, task: int, attachment: UploadFile, difficulty: List[str]):
|
||||
pass
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import io
|
||||
from typing import List
|
||||
|
||||
from fastapi import UploadFile
|
||||
from fastapi.responses import StreamingResponse, Response
|
||||
@@ -20,7 +21,7 @@ class ListeningController(IListeningController):
|
||||
else:
|
||||
return res
|
||||
|
||||
async def generate_listening_dialog(self, section_id: int, topic: str, difficulty: str):
|
||||
async def generate_listening_dialog(self, section_id: int, topic: str, difficulty: List[str]):
|
||||
return await self._service.generate_listening_dialog(section_id, topic, difficulty)
|
||||
|
||||
async def get_listening_question(self, dto: ListeningExercisesDTO):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import logging
|
||||
from typing import List
|
||||
|
||||
from ielts_be.controllers import ISpeakingController
|
||||
from ielts_be.services import ISpeakingService, IVideoGeneratorService
|
||||
@@ -11,7 +12,7 @@ class SpeakingController(ISpeakingController):
|
||||
self._vid_gen = vid_gen
|
||||
self._logger = logging.getLogger(__name__)
|
||||
|
||||
async def get_speaking_part(self, task: int, topic: str, second_topic: str, difficulty: str):
|
||||
async def get_speaking_part(self, task: int, topic: str, second_topic: str, difficulty: List[str]):
|
||||
return await self._service.get_speaking_part(task, topic, second_topic, difficulty)
|
||||
|
||||
async def get_avatars(self):
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from typing import List
|
||||
|
||||
from fastapi import UploadFile, HTTPException
|
||||
|
||||
from ielts_be.controllers import IWritingController
|
||||
@@ -9,10 +11,10 @@ class WritingController(IWritingController):
|
||||
def __init__(self, writing_service: IWritingService):
|
||||
self._service = writing_service
|
||||
|
||||
async def get_writing_task_general_question(self, task: int, topic: str, difficulty: str):
|
||||
async def get_writing_task_general_question(self, task: int, topic: str, difficulty: List[str]):
|
||||
return await self._service.get_writing_task_general_question(task, topic, difficulty)
|
||||
|
||||
async def get_writing_task_academic_question(self, task: int, attachment: UploadFile, difficulty: str):
|
||||
async def get_writing_task_academic_question(self, task: int, attachment: UploadFile, difficulty: List[str]):
|
||||
if attachment.content_type not in ['image/jpeg', 'image/png']:
|
||||
raise HTTPException(status_code=400, detail="Invalid file type. Only JPEG and PNG allowed.")
|
||||
return await self._service.get_writing_task_academic_question(task, attachment, difficulty)
|
||||
|
||||
Reference in New Issue
Block a user