You need to sign in or sign up before continuing.
Commit 5e747a50 authored by mingyard's avatar mingyard

feat:get asr token

parent 5f00878d
......@@ -17,6 +17,7 @@ import { Auth } from '@/common/decorators/auth.decorator';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { LoginResDto } from './dto/res/loginRes.dto';
import { TxAsrResDto } from './dto/res/txAsrRes.dto';
import { plainToClass } from 'class-transformer';
@ApiTags('auth')
@Controller('auth')
......@@ -85,6 +86,12 @@ export class AuthController {
@Auth()
@Post('getAsrToken')
async getAsrToken(): Promise<TxAsrResDto> {
return await this.authService.getTxAsrToken();
const result = await this.authService.getTxAsrToken();
if (!result) {
throw new Error('获取ASR token失败');
}
return plainToClass(TxAsrResDto, result, { excludeExtraneousValues: true });
}
}
......@@ -197,7 +197,7 @@ export class AuthService {
// 获取 asr token
async getTxAsrToken(): Promise<any> {
return await axiosPostRequest(
const result = await axiosPostRequest(
config.service.tts.txAsrTokenUrl,
{},
{
......@@ -206,5 +206,7 @@ export class AuthService {
},
},
);
return result?.data;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment