1234567891011121314151617181920212223242526272829303132 |
- using WingASRService.Tencent;
- using WingInterfaceLibrary.DTO.ASR;
- using WingInterfaceLibrary.Enum;
- using WingInterfaceLibrary.Interface;
- using WingInterfaceLibrary.Request.ASR;
- using WingServerCommon.Service;
- namespace WingASRService.Service
- {
- public class ASRService : JsonRpcService, IASRService
- {
- private void ThrowCustomerException(CustomerRpcCode customerRpcCodeEnum, string msg)
- {
- string customerErrorMsg = Enum.GetName(customerRpcCodeEnum) ?? string.Empty;
- ThrowRpcException((int)customerRpcCodeEnum, msg, customerErrorMsg);
- }
- public async Task<ASRResultDTO> CommitASRInfoAsync(CommitASRInfoRequest request)
- {
- var result = ASRApi.CallASRApi(request.Url, request.FileType);
- if (!result.isSuccess)
- {
- ThrowCustomerException(CustomerRpcCode.ASRError, result.message);
- }
- return await Task.FromResult(new ASRResultDTO
- {
- IsComplete = result.isSuccess,
- Content = result.message,
- });
- }
- }
- }
|