Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
translation-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinmingyuan
translation-server
Commits
5e747a50
You need to sign in or sign up before continuing.
Commit
5e747a50
authored
Jan 11, 2025
by
mingyard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:get asr token
parent
5f00878d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
auth.controller.ts
src/controller/auth/auth.controller.ts
+8
-1
auth.service.ts
src/controller/auth/auth.service.ts
+3
-1
No files found.
src/controller/auth/auth.controller.ts
View file @
5e747a50
...
...
@@ -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
});
}
}
src/controller/auth/auth.service.ts
View file @
5e747a50
...
...
@@ -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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment