ENCOA-295
This commit is contained in:
@@ -3,10 +3,9 @@ from logging import getLogger
|
||||
import random
|
||||
from typing import Dict, Any
|
||||
|
||||
import aiofiles
|
||||
from starlette.datastructures import UploadFile
|
||||
|
||||
from ielts_be.dtos.listening import GenerateListeningExercises, Dialog, ListeningExercises
|
||||
from ielts_be.dtos.listening import ListeningExercisesDTO, Dialog, ListeningExercises, ConversationPayload
|
||||
from ielts_be.exceptions.exceptions import TranscriptionException
|
||||
from ielts_be.repositories import IFileStorage, IDocumentStore
|
||||
from ielts_be.services import IListeningService, ILLMService, ITextToSpeechService, ISpeechToTextService
|
||||
@@ -114,7 +113,16 @@ 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, dto: GenerateListeningExercises):
|
||||
async def create_instructions(self, text: str) -> bytes:
|
||||
script = Dialog(conversation=[ConversationPayload(**{
|
||||
"text": text,
|
||||
"voice": "Matthew",
|
||||
"name": "",
|
||||
"gender": ""
|
||||
})])
|
||||
return await self._tts.text_to_speech(script, False)
|
||||
|
||||
async def get_listening_question(self, dto: ListeningExercisesDTO):
|
||||
start_id = 1
|
||||
exercise_tasks = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user