mirror of
https://github.com/ijaric/voice_assistant.git
synced 2025-05-24 14:33:26 +00:00
fix: [#56] add get_all
This commit is contained in:
parent
2349feb108
commit
71387f5e8c
|
@ -4,6 +4,10 @@ import lib.models as models
|
|||
|
||||
|
||||
class TTSRepositoryProtocol(typing.Protocol):
|
||||
@property
|
||||
async def voice_models(self) -> models.LIST_VOICE_MODELS_TYPE:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_audio_as_bytes(self, request: models.TTSCreateRequestModel) -> models.TTSCreateResponseModel:
|
||||
...
|
||||
|
||||
|
|
|
@ -31,3 +31,14 @@ class TTSService:
|
|||
if voice_models.models:
|
||||
response_models.extend(voice_models.models)
|
||||
return response_models
|
||||
|
||||
async def get_all_models(self) -> list[_models.AVAILABLE_MODELS_TYPE]:
|
||||
response_models: list[_models.AVAILABLE_MODELS_TYPE] = []
|
||||
for repository in self.repositories.values():
|
||||
response = await repository.voice_models
|
||||
for model in response.models:
|
||||
model.languages = [ # type: ignore
|
||||
_models.BaseLanguageCodesEnum[language.name] for language in model.languages
|
||||
]
|
||||
response_models.append(model)
|
||||
return response_models
|
||||
|
|
Loading…
Reference in New Issue
Block a user