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
19dfc9af
You need to sign in or sign up before continuing.
Commit
19dfc9af
authored
Dec 28, 2023
by
ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复相应bug
parent
38df065c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
8 deletions
+11
-8
PhotoRole.ts
src/renderer/plugins/live/PhotoRole.ts
+1
-1
ShowPhoto.vue
src/renderer/screens/ShowPhoto.vue
+5
-2
ShowVideo.vue
src/renderer/screens/ShowVideo.vue
+5
-5
No files found.
src/renderer/plugins/live/PhotoRole.ts
View file @
19dfc9af
...
...
@@ -351,7 +351,7 @@ export class PhotoRole extends EventEmitter {
return
new
Promise
<
boolean
>
((
resolve
)
=>
{
let
count
=
0
const
keepCalling
=
async
()
=>
{
if
(
count
>=
1
0
)
return
resolve
(
false
)
if
(
count
>=
3
0
)
return
resolve
(
false
)
count
++
const
{
status
}
=
await
this
.
_getLiveStatus
(
taskId
)
...
...
src/renderer/screens/ShowPhoto.vue
View file @
19dfc9af
...
...
@@ -368,6 +368,7 @@ function initLLMSocket(): Promise<WebSocket> {
async function endAudioInput() {
microphoneState.value = 'waitInput'
inputContext.ws?.close()
inputContext.mediaStream?.getTracks().forEach((track) => track.stop())
inputContext.audioContext?.close()
inputContext.audioContext2?.close()
...
...
@@ -443,8 +444,10 @@ async function onQ(question: string) {
photoRole!.on('asyncAnswer', onAsyncAnswer)
ws.onmessage = (message) => {
clearTimeout(messageTimeout)
try {
cons
t { text, event } = JSON.parse(message.data) as {
le
t { text, event } = JSON.parse(message.data) as {
event: string
message_num: number
text: string
...
...
@@ -460,12 +463,12 @@ async function onQ(question: string) {
return
}
text = text.replace(/\u0000/g, '').trim()
answer += text
photoRole!.answerArgs!.answer += answer
photoRole!.answerArgs!._typingAnswer.push(answer)
isTime && console.time('sliceAnswer')
isTime = false
clearTimeout(messageTimeout)
const textArr = text.split('')
for (let i = 0; i < textArr.length; i++) {
...
...
src/renderer/screens/ShowVideo.vue
View file @
19dfc9af
...
...
@@ -263,6 +263,7 @@ function initLLMSocket(): Promise<WebSocket> {
function
endAudioInput
()
{
microphoneState
.
value
=
'waitInput'
inputContext
.
ws
?.
close
()
inputContext
.
mediaStream
?.
getTracks
().
forEach
((
track
)
=>
track
.
stop
())
inputContext
.
audioContext
?.
close
()
inputContext
.
audioContext2
?.
close
()
...
...
@@ -360,12 +361,14 @@ async function onQ(question: string) {
let
sliceAnswerLength
=
10
inputContext
.
ws
=
ws
ws
.
onmessage
=
(
message
)
=>
{
clearTimeout
(
messageTimeout
)
if
(
microphoneState
.
value
===
'input'
)
{
return
}
try
{
cons
t
{
text
,
event
}
=
JSON
.
parse
(
message
.
data
)
as
{
le
t
{
text
,
event
}
=
JSON
.
parse
(
message
.
data
)
as
{
event
:
string
message_num
:
number
text
:
string
...
...
@@ -375,18 +378,15 @@ async function onQ(question: string) {
inputContext
.
answerArray
.
push
(
sliceAnswer
)
runTTSTask
()
sliceAnswer
=
''
inputContext
.
answerArray
.
push
(
sliceAnswer
)
sliceAnswer
=
''
inputContext
.
ws
?.
close
()
console
.
log
(
'----------------> answer: '
,
answer
)
return
}
text
=
text
.
replace
(
/
\u
0000/g
,
''
).
trim
()
answer
+=
text
isTime
&&
console
.
time
(
'sliceAnswer'
)
isTime
=
false
clearTimeout
(
messageTimeout
)
const
textArr
=
text
.
split
(
''
)
for
(
let
i
=
0
;
i
<
textArr
.
length
;
i
++
)
{
...
...
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