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
You need to sign in or sign up before continuing.
Commit
329f53c3
authored
Dec 06, 2023
by
ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 视频数字人麦克风状态流程优化
parent
afe81980
Hide 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) {
...
@@ -326,7 +326,7 @@ async function onAsr(question: string) {
isTime
=
false
isTime
=
false
sliceAnswer
+=
text
sliceAnswer
+=
text
if
(
/
[
。,?!;,.?!;
]
/
.
test
(
text
)
&&
sliceAnswer
.
length
>=
2
0
)
{
if
(
/
[
。,?!;,.?!;
]
/
.
test
(
text
)
&&
sliceAnswer
.
length
>=
1
0
)
{
console
.
timeEnd
(
'sliceAnswer'
)
console
.
timeEnd
(
'sliceAnswer'
)
answerArray
.
push
(
sliceAnswer
)
answerArray
.
push
(
sliceAnswer
)
runTTSTask
(
answerArray
)
runTTSTask
(
answerArray
)
...
@@ -335,6 +335,7 @@ async function onAsr(question: string) {
...
@@ -335,6 +335,7 @@ async function onAsr(question: string) {
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'返回答案错误 -----> '
+
JSON
.
stringify
(
error
))
console
.
log
(
'返回答案错误 -----> '
+
JSON
.
stringify
(
error
))
microphoneState
.
value
=
'input'
;
}
}
}
}
...
@@ -362,13 +363,17 @@ async function runTTSTask(tasks: string[]) {
...
@@ -362,13 +363,17 @@ async function runTTSTask(tasks: string[]) {
if
(
task
.
length
<
1
)
continue
if
(
task
.
length
<
1
)
continue
console
.
time
(
task
+
' TTS: '
)
console
.
time
(
task
+
' TTS: '
)
microphoneState
.
value
=
'loading'
;
const
res
=
await
localTTS
({
const
res
=
await
localTTS
({
url
:
settings
.
ttsHost
,
url
:
settings
.
ttsHost
,
text
:
task
,
text
:
task
,
audio_path
:
settings
.
userData
audio_path
:
settings
.
userData
})
})
console
.
log
(
'----------------> TTS:'
,
res
[
0
].
text
)
console
.
log
(
'----------------> TTS:'
,
res
[
0
].
text
)
console
.
timeEnd
(
task
+
' TTS: '
)
console
.
timeEnd
(
task
+
' TTS: '
)
const
audio
=
new
Audio
(
`file://
${
res
[
0
].
text
}
`
)
const
audio
=
new
Audio
(
`file://
${
res
[
0
].
text
}
`
)
audio
.
load
()
audio
.
load
()
ttsAudios
.
push
(
audio
)
ttsAudios
.
push
(
audio
)
...
@@ -392,17 +397,18 @@ async function runAudioPlay() {
...
@@ -392,17 +397,18 @@ async function runAudioPlay() {
if
(
!
audio
)
{
if
(
!
audio
)
{
isPlayRunning
=
false
;
isPlayRunning
=
false
;
videos
[
0
].
value
!
.
pause
();
videos
[
0
].
value
!
.
pause
();
microphoneState
.
value
=
'input'
;
!
isTTSRunning
&&
(
microphoneState
.
value
=
'input'
)
;
return
return
}
}
audio
.
onended
=
()
=>
{
audio
.
onended
=
()
=>
{
isPlayRunning
=
false
isPlayRunning
=
false
loadVideo
(
new
URL
(
'/libai/10.mp4'
,
import
.
meta
.
url
).
href
)
videos
[
1
].
value
!
.
loop
=
true
videos
[
1
].
value
!
.
muted
=
true
runAudioPlay
()
runAudioPlay
()
}
}
await
audio
.
play
();
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'
;
microphoneState
.
value
=
'reply'
;
}
}
...
@@ -479,12 +485,13 @@ async function xfTTS(text: string) {
...
@@ -479,12 +485,13 @@ async function xfTTS(text: string) {
<
style
scoped
>
<
style
scoped
>
.voice
{
.voice
{
display
:
flex
;
justify-content
:
center
;
position
:
fixed
;
position
:
fixed
;
top
:
70%
;
left
:
0
;
left
:
0
;
right
:
0
;
right
:
0
;
top
:
70%
;
z-index
:
99
;
display
:
flex
;
justify-content
:
center
;
margin
:
auto
;
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