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
adee6933
Commit
adee6933
authored
Jan 08, 2024
by
ali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: AnswerBox
parent
d9ea3ea9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
15 deletions
+24
-15
AnswerBox.vue
src/renderer/components/common/AnswerBox.vue
+18
-10
PhotoRole.ts
src/renderer/plugins/live/PhotoRole.ts
+1
-1
ShowPhoto.vue
src/renderer/screens/ShowPhoto.vue
+5
-4
No files found.
src/renderer/components/common/AnswerBox.vue
View file @
adee6933
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
}
from
'vue'
;
import
{
ref
,
watch
}
from
'vue'
;
interface
Props
{
interface
Props
{
visible
?:
boolean
;
visible
?:
boolean
;
...
@@ -18,7 +18,7 @@ interface EmitType {
...
@@ -18,7 +18,7 @@ interface EmitType {
}
}
const
emits
=
defineEmits
<
EmitType
>
();
const
emits
=
defineEmits
<
EmitType
>
();
withDefaults
(
defineProps
<
Props
>
(),
{
const
props
=
withDefaults
(
defineProps
<
Props
>
(),
{
answerData
()
{
answerData
()
{
return
[];
return
[];
},
},
...
@@ -50,10 +50,17 @@ function playVideo() {
...
@@ -50,10 +50,17 @@ function playVideo() {
}
}
const
loadingImg
=
new
URL
(
'/images/Ellipsis.gif'
,
import
.
meta
.
url
).
href
;
const
loadingImg
=
new
URL
(
'/images/Ellipsis.gif'
,
import
.
meta
.
url
).
href
;
const
scroll
=
ref
<
HTMLDivElement
|
null
>
(
null
);
watch
(
props
.
answerData
,
(
val
)
=>
{
if
(
scroll
.
value
)
{
scroll
.
value
.
scrollTop
=
9999
;
}
})
</
script
>
</
script
>
<
template
>
<
template
>
<div
<div
:style=
"
{ width: '
170px
' }"
:style=
"
{ width: '
30%
' }"
class="ans-layout"
class="ans-layout"
>
>
<div
<div
...
@@ -70,6 +77,7 @@ const loadingImg = new URL('/images/Ellipsis.gif', import.meta.url).href;
...
@@ -70,6 +77,7 @@ const loadingImg = new URL('/images/Ellipsis.gif', import.meta.url).href;
>
>
<div
<div
class=
"scroll"
class=
"scroll"
ref=
"scroll"
:style=
"
{ 'max-height': '249.6px' }"
:style=
"
{ 'max-height': '249.6px' }"
>
>
<div
<div
...
@@ -132,6 +140,7 @@ const loadingImg = new URL('/images/Ellipsis.gif', import.meta.url).href;
...
@@ -132,6 +140,7 @@ const loadingImg = new URL('/images/Ellipsis.gif', import.meta.url).href;
<
/ul
>
<
/ul
>
<
/div
>
<
/div
>
<!--
等待
gif
-->
<!--
等待
gif
-->
<
/div
>
<
div
<
div
v
-
if
=
"loading"
v
-
if
=
"loading"
class
=
"text-waitImage"
class
=
"text-waitImage"
...
@@ -141,7 +150,6 @@ const loadingImg = new URL('/images/Ellipsis.gif', import.meta.url).href;
...
@@ -141,7 +150,6 @@ const loadingImg = new URL('/images/Ellipsis.gif', import.meta.url).href;
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
teleport
to
=
"body"
>
<
teleport
to
=
"body"
>
<
div
<
div
v
-
if
=
"isPreview"
v
-
if
=
"isPreview"
...
@@ -192,7 +200,7 @@ const loadingImg = new URL('/images/Ellipsis.gif', import.meta.url).href;
...
@@ -192,7 +200,7 @@ const loadingImg = new URL('/images/Ellipsis.gif', import.meta.url).href;
padding
:
16
px
;
padding
:
16
px
;
}
}
.
text
-
box
{
.
text
-
box
{
margin
-
bottom
:
15
px
;
/* margin-bottom: 15px; */
}
}
.
img
-
box
,
.
img
-
box
,
.
video
-
box
{
.
video
-
box
{
...
...
src/renderer/plugins/live/PhotoRole.ts
View file @
adee6933
...
@@ -177,7 +177,7 @@ export class PhotoRole extends EventEmitter {
...
@@ -177,7 +177,7 @@ export class PhotoRole extends EventEmitter {
this
.
_typingRunner
=
true
this
.
_typingRunner
=
true
// 加延迟是为了 playing 状态时,能跟声音保持相对同步
// 加延迟是为了 playing 状态时,能跟声音保持相对同步
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
2
000
))
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
1
000
))
while
(
this
.
answerArgs
.
_typingAnswer
.
length
)
{
while
(
this
.
answerArgs
.
_typingAnswer
.
length
)
{
this
.
answerArgs
.
asyncAnswer
+=
this
.
answerArgs
.
_typingAnswer
.
shift
()
this
.
answerArgs
.
asyncAnswer
+=
this
.
answerArgs
.
_typingAnswer
.
shift
()
...
...
src/renderer/screens/ShowPhoto.vue
View file @
adee6933
...
@@ -126,6 +126,7 @@ async function onAsyncAnswer(ans: PhotoAnswer) {
...
@@ -126,6 +126,7 @@ async function onAsyncAnswer(ans: PhotoAnswer) {
if (microphoneState.value === 'reply' && ans.playState === 'pause' && (await checkSteps())) {
if (microphoneState.value === 'reply' && ans.playState === 'pause' && (await checkSteps())) {
microphoneState.value = 'input'
microphoneState.value = 'input'
inputContext.answerProp.value.loading = false
}
}
}
}
...
@@ -320,7 +321,8 @@ async function onQ(question: string) {
...
@@ -320,7 +321,8 @@ async function onQ(question: string) {
console.log('----------------> question: ', question)
console.log('----------------> question: ', question)
microphoneState.value = 'loading'
microphoneState.value = 'loading'
inputContext.answerProp.value.question = question;
inputContext.answerProp.value.question = question.replace(/\s/g, '');
inputContext.answerProp.value.answerData.length = 0;
inputContext.answerProp.value.loading = true;
inputContext.answerProp.value.loading = true;
const { pose, stepResolve, stepReject } = createStep()
const { pose, stepResolve, stepReject } = createStep()
...
@@ -393,7 +395,6 @@ async function llmLoop(question: string) {
...
@@ -393,7 +395,6 @@ async function llmLoop(question: string) {
const
audioList
=
results
[
0
].
audio_list
as
string
[]
const
audioList
=
results
[
0
].
audio_list
as
string
[]
if
(
audioList
.
length
===
0
)
continue
if
(
audioList
.
length
===
0
)
continue
const
isEnd
=
audioList
.
at
(
-
1
)
===
'stream_end'
const
isEnd
=
audioList
.
at
(
-
1
)
===
'stream_end'
inputContext
.
answerProp
.
value
.
loading
=
!
isEnd
if
(
isEnd
)
audioList
.
pop
()
if
(
isEnd
)
audioList
.
pop
()
...
@@ -412,8 +413,8 @@ async function llmLoop(question: string) {
...
@@ -412,8 +413,8 @@ async function llmLoop(question: string) {
}
}
console
.
log
(
results
[
0
].
text
[
index
+
i
]
+
':'
+
newList
[
i
])
console
.
log
(
results
[
0
].
text
[
index
+
i
]
+
':'
+
newList
[
i
])
photoRole
!
.
answerArgs
!
.
answer
+=
newList
[
i
]
photoRole
!
.
answerArgs
!
.
answer
+=
results
[
0
].
text
[
index
+
i
]
photoRole
!
.
answerArgs
!
.
_typingAnswer
.
push
(...
newList
[
i
].
split
(
''
))
photoRole
!
.
answerArgs
!
.
_typingAnswer
.
push
(...
results
[
0
].
text
[
index
+
i
].
split
(
''
))
const
path
=
await
uploadFile
({
filePath
:
newList
[
i
]
})
const
path
=
await
uploadFile
({
filePath
:
newList
[
i
]
})
photoRole
?.
enQueue
({
photoRole
?.
enQueue
({
...
...
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