Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-boutique-work-wechat
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9240570c
authored
May 22, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
格式
1 parent
27fc18fe
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
34 deletions
packageEquity/pages/aiCheck/chat/chat.js
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.js
packageEquity/pages/aiExcercise/list/components/input-box.js
utils/aliyun/sr.js
utils/aliyun/st.js
packageEquity/pages/aiCheck/chat/chat.js
View file @
9240570
...
...
@@ -339,7 +339,7 @@ Page({
if
(
next_step
==
"over"
)
{
setTimeout
(()
=>
{
this
.
toResult
();
},
2
000
);
},
3
000
);
}
});
},
...
...
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.js
View file @
9240570
...
...
@@ -34,8 +34,6 @@ Component({
*/
data
:
{
times
:
0
,
recorder1
:
wx
.
getRecorderManager
(),
recorder2
:
wx
.
getRecorderManager
(),
},
lifetimes
:{
attached
()
{
...
...
@@ -44,7 +42,7 @@ Component({
},
detached
:
function
()
{
this
.
data
.
srStart
=
false
this
.
data
.
recorder1
.
stop
()
wx
.
getRecorderManager
()
.
stop
()
if
(
this
.
data
.
sr
)
{
this
.
data
.
sr
.
shutdown
()
}
else
{
...
...
@@ -66,8 +64,7 @@ Component({
},
onSrStop
:
async
function
()
{
console
.
log
(
'onSrStop'
)
this
.
data
.
recorder1
.
stop
()
this
.
data
.
recorder2
.
stop
();
wx
.
getRecorderManager
().
stop
()
await
sleep
(
500
)
if
(
this
.
data
.
srStart
&&
this
.
data
.
sr
)
{
try
{
...
...
@@ -111,14 +108,7 @@ Component({
console
.
log
(
"start failed:"
+
e
)
return
}
this
.
data
.
recorder1
.
start
({
duration
:
600000
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
format
:
"PCM"
,
frameSize
:
4
})
this
.
data
.
recorder2
.
start
({
wx
.
getRecorderManager
().
start
({
duration
:
600000
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
...
...
@@ -127,7 +117,7 @@ Component({
})
},
connectSr
:
async
function
(
options
)
{
this
.
data
.
recorder1
.
onFrameRecorded
((
res
)
=>
{
wx
.
getRecorderManager
()
.
onFrameRecorded
((
res
)
=>
{
if
(
res
.
isLastFrame
)
{
console
.
log
(
"record done"
)
}
...
...
@@ -136,23 +126,10 @@ Component({
this
.
data
.
sr
.
sendAudio
(
res
.
frameBuffer
)
}
})
this
.
data
.
recorder1
.
onStart
(()
=>
{
wx
.
getRecorderManager
()
.
onStart
(()
=>
{
console
.
log
(
"start recording..."
)
})
this
.
data
.
recorder2
.
onStop
((
res
)
=>
{
console
.
log
(
res
.
tempFilePath
)
// if (res.tempFilePath) {
// const {isClose} = this.data
// if(isClose) {
// wx.removeSavedFile({
// filePath: res.tempFilePath
// })
// }else {
// this.setData({filePath:res.tempFilePath})
// }
// }
})
this
.
data
.
recorder1
.
onStop
((
res
)
=>
{
wx
.
getRecorderManager
().
onStop
((
res
)
=>
{
console
.
log
(
"stop recording..."
)
if
(
res
.
tempFilePath
)
{
const
{
isClose
}
=
this
.
data
...
...
@@ -165,7 +142,7 @@ Component({
}
}
})
this
.
data
.
recorder1
.
onError
((
res
)
=>
{
wx
.
getRecorderManager
()
.
onError
((
res
)
=>
{
console
.
log
(
"recording failed:"
+
res
)
})
try
{
...
...
packageEquity/pages/aiExcercise/list/components/input-box.js
View file @
9240570
...
...
@@ -122,7 +122,7 @@ Component({
duration
:
600000
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
format
:
"
PCM
"
,
format
:
"
mp3
"
,
frameSize
:
4
})
},
...
...
utils/aliyun/sr.js
View file @
9240570
...
...
@@ -29,7 +29,7 @@ class SpeechRecognition {
defaultStartParams
()
{
return
{
format
:
"
pcm
"
,
format
:
"
mp3
"
,
sample_rate
:
16000
,
enable_intermediate_result
:
true
,
enable_punctuation_prediction
:
true
,
...
...
utils/aliyun/st.js
View file @
9240570
...
...
@@ -29,7 +29,7 @@ class SpeechTranscription {
defaultStartParams
()
{
return
{
format
:
"
pcm
"
,
format
:
"
mp3
"
,
sample_rate
:
16000
,
enable_intermediate_result
:
true
,
enable_punctuation_prediction
:
true
,
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment