Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
C
CharIP-Electron
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
ali
CharIP-Electron
Commits
329f53c3
Commit
329f53c3
authored
Dec 06, 2023
by
ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 视频数字人麦克风状态流程优化
parent
afe81980
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
ShowVideo.vue
src/renderer/screens/ShowVideo.vue
+15
-8
No files found.
src/renderer/screens/ShowVideo.vue
View file @
329f53c3
...
...
@@ -326,7 +326,7 @@ async function onAsr(question: string) {
isTime
=
false
sliceAnswer
+=
text
if
(
/
[
。,?!;,.?!;
]
/
.
test
(
text
)
&&
sliceAnswer
.
length
>=
2
0
)
{
if
(
/
[
。,?!;,.?!;
]
/
.
test
(
text
)
&&
sliceAnswer
.
length
>=
1
0
)
{
console
.
timeEnd
(
'sliceAnswer'
)
answerArray
.
push
(
sliceAnswer
)
runTTSTask
(
answerArray
)
...
...
@@ -335,6 +335,7 @@ async function onAsr(question: string) {
}
}
catch
(
error
)
{
console
.
log
(
'返回答案错误 -----> '
+
JSON
.
stringify
(
error
))
microphoneState
.
value
=
'input'
;
}
}
...
...
@@ -362,13 +363,17 @@ async function runTTSTask(tasks: string[]) {
if
(
task
.
length
<
1
)
continue
console
.
time
(
task
+
' TTS: '
)
microphoneState
.
value
=
'loading'
;
const
res
=
await
localTTS
({
url
:
settings
.
ttsHost
,
text
:
task
,
audio_path
:
settings
.
userData
})
console
.
log
(
'----------------> TTS:'
,
res
[
0
].
text
)
console
.
timeEnd
(
task
+
' TTS: '
)
const
audio
=
new
Audio
(
`file://
${
res
[
0
].
text
}
`
)
audio
.
load
()
ttsAudios
.
push
(
audio
)
...
...
@@ -392,17 +397,18 @@ async function runAudioPlay() {
if
(
!
audio
)
{
isPlayRunning
=
false
;
videos
[
0
].
value
!
.
pause
();
microphoneState
.
value
=
'input'
;
!
isTTSRunning
&&
(
microphoneState
.
value
=
'input'
)
;
return
}
audio
.
onended
=
()
=>
{
isPlayRunning
=
false
loadVideo
(
new
URL
(
'/libai/10.mp4'
,
import
.
meta
.
url
).
href
)
videos
[
1
].
value
!
.
loop
=
true
videos
[
1
].
value
!
.
muted
=
true
runAudioPlay
()
}
await
audio
.
play
();
loadVideo
(
new
URL
(
'/libai/10.mp4'
,
import
.
meta
.
url
).
href
)
videos
[
1
].
value
!
.
loop
=
true
videos
[
1
].
value
!
.
muted
=
true
microphoneState
.
value
=
'reply'
;
}
...
...
@@ -479,12 +485,13 @@ async function xfTTS(text: string) {
<
style
scoped
>
.voice
{
display
:
flex
;
justify-content
:
center
;
position
:
fixed
;
top
:
70%
;
left
:
0
;
right
:
0
;
top
:
70%
;
z-index
:
99
;
display
:
flex
;
justify-content
:
center
;
margin
:
auto
;
}
...
...
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