Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
1b8b1123
authored
Dec 09, 2024
by
Archer
Committed by
GitHub
Dec 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: speech check (#3351)
* perf: speech check * perf: version
parent
15dc7b22
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
7 deletions
+16
-7
projects/app/package.json
+1
-1
projects/app/src/pages/api/v1/audio/transcriptions.ts
+13
-4
projects/app/src/pages/price/components/Points.tsx
+1
-1
projects/app/src/web/common/utils/voice.ts
+1
-1
No files found.
projects/app/package.json
View file @
1b8b1123
{
{
"name"
:
"
app
"
,
"name"
:
"
app
"
,
"version"
:
"4.8.1
4
"
,
"version"
:
"4.8.1
5
"
,
"private"
:
false
,
"private"
:
false
,
"scripts"
:
{
"scripts"
:
{
"dev"
:
"next dev"
,
"dev"
:
"next dev"
,
...
...
projects/app/src/pages/api/v1/audio/transcriptions.ts
View file @
1b8b1123
...
@@ -8,16 +8,17 @@ import { authChatCrud } from '@/service/support/permission/auth/chat';
...
@@ -8,16 +8,17 @@ import { authChatCrud } from '@/service/support/permission/auth/chat';
import
{
OutLinkChatAuthProps
}
from
'@fastgpt/global/support/permission/chat'
;
import
{
OutLinkChatAuthProps
}
from
'@fastgpt/global/support/permission/chat'
;
import
{
NextAPI
}
from
'@/service/middleware/entry'
;
import
{
NextAPI
}
from
'@/service/middleware/entry'
;
import
{
aiTranscriptions
}
from
'@fastgpt/service/core/ai/audio/transcriptions'
;
import
{
aiTranscriptions
}
from
'@fastgpt/service/core/ai/audio/transcriptions'
;
import
{
useReqFrequencyLimit
}
from
'@fastgpt/service/common/middle/reqFrequencyLimit'
;
const
upload
=
getUploadModel
({
const
upload
=
getUploadModel
({
maxSize
:
20
maxSize
:
5
});
});
async
function
handler
(
req
:
NextApiRequest
,
res
:
NextApiResponse
<
any
>
)
{
async
function
handler
(
req
:
NextApiRequest
,
res
:
NextApiResponse
<
any
>
)
{
let
filePaths
:
string
[]
=
[];
let
filePaths
:
string
[]
=
[];
try
{
try
{
cons
t
{
le
t
{
file
,
file
,
data
:
{
appId
,
duration
,
shareId
,
outLinkUid
,
teamId
:
spaceTeamId
,
teamToken
}
data
:
{
appId
,
duration
,
shareId
,
outLinkUid
,
teamId
:
spaceTeamId
,
teamToken
}
}
=
await
upload
.
doUpload
<
}
=
await
upload
.
doUpload
<
...
@@ -42,9 +43,17 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
...
@@ -42,9 +43,17 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
if
(
!
file
)
{
if
(
!
file
)
{
throw
new
Error
(
'file not found'
);
throw
new
Error
(
'file not found'
);
}
}
if
(
duration
===
undefined
)
{
throw
new
Error
(
'duration not found'
);
}
duration
=
duration
<
1
?
1
:
duration
;
// auth role
// auth role
const
{
teamId
,
tmbId
}
=
await
authChatCrud
({
req
,
authToken
:
true
,
...
req
.
body
});
const
{
teamId
,
tmbId
}
=
await
authChatCrud
({
req
,
authToken
:
true
,
...
req
.
body
});
// auth app
// auth app
// const app = await MongoApp.findById(appId, 'modules').lean();
// const app = await MongoApp.findById(appId, 'modules').lean();
...
@@ -80,7 +89,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
...
@@ -80,7 +89,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
removeFilesByPaths
(
filePaths
);
removeFilesByPaths
(
filePaths
);
}
}
export
default
NextAPI
(
handler
);
export
default
NextAPI
(
useReqFrequencyLimit
(
1
,
2
),
handler
);
export
const
config
=
{
export
const
config
=
{
api
:
{
api
:
{
...
...
projects/app/src/pages/price/components/Points.tsx
View file @
1b8b1123
...
@@ -141,7 +141,7 @@ export const AiPointsTable = () => {
...
@@ -141,7 +141,7 @@ export const AiPointsTable = () => {
<
Box
flex=
{
'1 0 0'
}
>
<
Box
flex=
{
'1 0 0'
}
>
{
whisperModel
?.
charsPointsPrice
+
{
whisperModel
?.
charsPointsPrice
+
t
(
'common:support.wallet.subscription.point'
)
+
t
(
'common:support.wallet.subscription.point'
)
+
' /
100
0'
+
' /
6
0'
+
t
(
'common:unit.minute'
)
}
t
(
'common:unit.minute'
)
}
</
Box
>
</
Box
>
</
Flex
>
</
Flex
>
...
...
projects/app/src/web/common/utils/voice.ts
View file @
1b8b1123
...
@@ -103,7 +103,7 @@ export const useAudioPlay = (
...
@@ -103,7 +103,7 @@ export const useAudioPlay = (
const
cancelAudio
=
useCallback
(()
=>
{
const
cancelAudio
=
useCallback
(()
=>
{
try
{
try
{
window
.
speechSynthesis
?.
cancel
();
window
.
speechSynthesis
?.
cancel
();
audioController
.
current
.
abort
(
''
);
!
audioController
.
current
.
signal
.
aborted
&&
audioController
.
current
.
abort
(
);
}
catch
(
error
)
{}
}
catch
(
error
)
{}
if
(
audioRef
.
current
)
{
if
(
audioRef
.
current
)
{
audioRef
.
current
.
pause
();
audioRef
.
current
.
pause
();
...
...
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