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
Show 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({
...
@@ -339,7 +339,7 @@ Page({
if
(
next_step
==
"over"
)
{
if
(
next_step
==
"over"
)
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
toResult
();
this
.
toResult
();
},
2
000
);
},
3
000
);
}
}
});
});
},
},
...
...
packageEquity/pages/aiCheck/components/SpeechPopup/SpeechPopup.js
View file @
9240570
...
@@ -34,8 +34,6 @@ Component({
...
@@ -34,8 +34,6 @@ Component({
*/
*/
data
:
{
data
:
{
times
:
0
,
times
:
0
,
recorder1
:
wx
.
getRecorderManager
(),
recorder2
:
wx
.
getRecorderManager
(),
},
},
lifetimes
:{
lifetimes
:{
attached
()
{
attached
()
{
...
@@ -44,7 +42,7 @@ Component({
...
@@ -44,7 +42,7 @@ Component({
},
},
detached
:
function
()
{
detached
:
function
()
{
this
.
data
.
srStart
=
false
this
.
data
.
srStart
=
false
this
.
data
.
recorder1
.
stop
()
wx
.
getRecorderManager
()
.
stop
()
if
(
this
.
data
.
sr
)
{
if
(
this
.
data
.
sr
)
{
this
.
data
.
sr
.
shutdown
()
this
.
data
.
sr
.
shutdown
()
}
else
{
}
else
{
...
@@ -66,8 +64,7 @@ Component({
...
@@ -66,8 +64,7 @@ Component({
},
},
onSrStop
:
async
function
()
{
onSrStop
:
async
function
()
{
console
.
log
(
'onSrStop'
)
console
.
log
(
'onSrStop'
)
this
.
data
.
recorder1
.
stop
()
wx
.
getRecorderManager
().
stop
()
this
.
data
.
recorder2
.
stop
();
await
sleep
(
500
)
await
sleep
(
500
)
if
(
this
.
data
.
srStart
&&
this
.
data
.
sr
)
{
if
(
this
.
data
.
srStart
&&
this
.
data
.
sr
)
{
try
{
try
{
...
@@ -111,14 +108,7 @@ Component({
...
@@ -111,14 +108,7 @@ Component({
console
.
log
(
"start failed:"
+
e
)
console
.
log
(
"start failed:"
+
e
)
return
return
}
}
this
.
data
.
recorder1
.
start
({
wx
.
getRecorderManager
().
start
({
duration
:
600000
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
format
:
"PCM"
,
frameSize
:
4
})
this
.
data
.
recorder2
.
start
({
duration
:
600000
,
duration
:
600000
,
numberOfChannels
:
1
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
sampleRate
:
16000
,
...
@@ -127,7 +117,7 @@ Component({
...
@@ -127,7 +117,7 @@ Component({
})
})
},
},
connectSr
:
async
function
(
options
)
{
connectSr
:
async
function
(
options
)
{
this
.
data
.
recorder1
.
onFrameRecorded
((
res
)
=>
{
wx
.
getRecorderManager
()
.
onFrameRecorded
((
res
)
=>
{
if
(
res
.
isLastFrame
)
{
if
(
res
.
isLastFrame
)
{
console
.
log
(
"record done"
)
console
.
log
(
"record done"
)
}
}
...
@@ -136,23 +126,10 @@ Component({
...
@@ -136,23 +126,10 @@ Component({
this
.
data
.
sr
.
sendAudio
(
res
.
frameBuffer
)
this
.
data
.
sr
.
sendAudio
(
res
.
frameBuffer
)
}
}
})
})
this
.
data
.
recorder1
.
onStart
(()
=>
{
wx
.
getRecorderManager
()
.
onStart
(()
=>
{
console
.
log
(
"start recording..."
)
console
.
log
(
"start recording..."
)
})
})
this
.
data
.
recorder2
.
onStop
((
res
)
=>
{
wx
.
getRecorderManager
().
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
)
=>
{
console
.
log
(
"stop recording..."
)
console
.
log
(
"stop recording..."
)
if
(
res
.
tempFilePath
)
{
if
(
res
.
tempFilePath
)
{
const
{
isClose
}
=
this
.
data
const
{
isClose
}
=
this
.
data
...
@@ -165,7 +142,7 @@ Component({
...
@@ -165,7 +142,7 @@ Component({
}
}
}
}
})
})
this
.
data
.
recorder1
.
onError
((
res
)
=>
{
wx
.
getRecorderManager
()
.
onError
((
res
)
=>
{
console
.
log
(
"recording failed:"
+
res
)
console
.
log
(
"recording failed:"
+
res
)
})
})
try
{
try
{
...
...
packageEquity/pages/aiExcercise/list/components/input-box.js
View file @
9240570
...
@@ -122,7 +122,7 @@ Component({
...
@@ -122,7 +122,7 @@ Component({
duration
:
600000
,
duration
:
600000
,
numberOfChannels
:
1
,
numberOfChannels
:
1
,
sampleRate
:
16000
,
sampleRate
:
16000
,
format
:
"
PCM
"
,
format
:
"
mp3
"
,
frameSize
:
4
frameSize
:
4
})
})
},
},
...
...
utils/aliyun/sr.js
View file @
9240570
...
@@ -29,7 +29,7 @@ class SpeechRecognition {
...
@@ -29,7 +29,7 @@ class SpeechRecognition {
defaultStartParams
()
{
defaultStartParams
()
{
return
{
return
{
format
:
"
pcm
"
,
format
:
"
mp3
"
,
sample_rate
:
16000
,
sample_rate
:
16000
,
enable_intermediate_result
:
true
,
enable_intermediate_result
:
true
,
enable_punctuation_prediction
:
true
,
enable_punctuation_prediction
:
true
,
...
...
utils/aliyun/st.js
View file @
9240570
...
@@ -29,7 +29,7 @@ class SpeechTranscription {
...
@@ -29,7 +29,7 @@ class SpeechTranscription {
defaultStartParams
()
{
defaultStartParams
()
{
return
{
return
{
format
:
"
pcm
"
,
format
:
"
mp3
"
,
sample_rate
:
16000
,
sample_rate
:
16000
,
enable_intermediate_result
:
true
,
enable_intermediate_result
:
true
,
enable_punctuation_prediction
:
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