Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
2c6dbe13
authored
Jan 25, 2024
by
Archer
Committed by
GitHub
Jan 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: retry input and whisper (#785)
parent
31811662
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
31 deletions
+25
-31
projects/app/src/components/ChatBox/index.tsx
+24
-30
projects/app/src/web/common/hooks/useSpeech.ts
+1
-1
No files found.
projects/app/src/components/ChatBox/index.tsx
View file @
2c6dbe13
...
@@ -586,9 +586,30 @@ const ChatBox = (
...
@@ -586,9 +586,30 @@ const ChatBox = (
},
},
[
onUpdateVariable
]
[
onUpdateVariable
]
);
);
const
HumanChatCard
=
useCallback
(
({
item
,
index
}:
{
item
:
ChatSiteItemType
;
index
:
number
})
=>
{
return
(
return
(
<
Flex
flexDirection=
{
'column'
}
h=
{
'100%'
}
>
<
Script
src=
"/js/html2pdf.bundle.min.js"
strategy=
"lazyOnload"
></
Script
>
{
/* chat box container */
}
<
Box
ref=
{
ChatBoxRef
}
flex=
{
'1 0 0'
}
h=
{
0
}
w=
{
'100%'
}
overflow=
{
'overlay'
}
px=
{
[
4
,
0
]
}
pb=
{
3
}
>
<
Box
id=
"chat-container"
maxW=
{
[
'100%'
,
'92%'
]
}
h=
{
'100%'
}
mx=
{
'auto'
}
>
{
showEmpty
&&
<
Empty
/>
}
{
!!
welcomeText
&&
<
WelcomeText
appAvatar=
{
appAvatar
}
welcomeText=
{
welcomeText
}
/>
}
{
/* variable input */
}
{
!!
variableModules
?.
length
&&
(
<
VariableInput
appAvatar=
{
appAvatar
}
variableModules=
{
variableModules
}
variableIsFinish=
{
variableIsFinish
}
chatForm=
{
chatForm
}
onSubmitVariables=
{
onSubmitVariables
}
/>
)
}
{
/* chat history */
}
<
Box
id=
{
'history'
}
>
{
chatHistory
.
map
((
item
,
index
)
=>
(
<
Box
key=
{
item
.
dataId
}
py=
{
5
}
>
{
item
.
obj
===
'Human'
&&
(
<>
<>
{
/* control icon */
}
{
/* control icon */
}
<
Flex
w=
{
'100%'
}
alignItems=
{
'center'
}
justifyContent=
{
'flex-end'
}
>
<
Flex
w=
{
'100%'
}
alignItems=
{
'center'
}
justifyContent=
{
'flex-end'
}
>
...
@@ -601,7 +622,7 @@ const ChatBox = (
...
@@ -601,7 +622,7 @@ const ChatBox = (
}
}
:
undefined
:
undefined
}
}
onRetry=
{
useCallback
(()
=>
retryInput
(
index
),
[
index
]
)
}
onRetry=
{
()
=>
retryInput
(
index
)
}
/>
/>
<
ChatAvatar
src=
{
userAvatar
}
type=
{
'Human'
}
/>
<
ChatAvatar
src=
{
userAvatar
}
type=
{
'Human'
}
/>
</
Flex
>
</
Flex
>
...
@@ -618,34 +639,7 @@ const ChatBox = (
...
@@ -618,34 +639,7 @@ const ChatBox = (
</
Card
>
</
Card
>
</
Box
>
</
Box
>
</>
</>
);
},
[]
);
return
(
<
Flex
flexDirection=
{
'column'
}
h=
{
'100%'
}
>
<
Script
src=
"/js/html2pdf.bundle.min.js"
strategy=
"lazyOnload"
></
Script
>
{
/* chat box container */
}
<
Box
ref=
{
ChatBoxRef
}
flex=
{
'1 0 0'
}
h=
{
0
}
w=
{
'100%'
}
overflow=
{
'overlay'
}
px=
{
[
4
,
0
]
}
pb=
{
3
}
>
<
Box
id=
"chat-container"
maxW=
{
[
'100%'
,
'92%'
]
}
h=
{
'100%'
}
mx=
{
'auto'
}
>
{
showEmpty
&&
<
Empty
/>
}
{
!!
welcomeText
&&
<
WelcomeText
appAvatar=
{
appAvatar
}
welcomeText=
{
welcomeText
}
/>
}
{
/* variable input */
}
{
!!
variableModules
?.
length
&&
(
<
VariableInput
appAvatar=
{
appAvatar
}
variableModules=
{
variableModules
}
variableIsFinish=
{
variableIsFinish
}
chatForm=
{
chatForm
}
onSubmitVariables=
{
onSubmitVariables
}
/>
)
}
)
}
{
/* chat history */
}
<
Box
id=
{
'history'
}
>
{
chatHistory
.
map
((
item
,
index
)
=>
(
<
Box
key=
{
item
.
dataId
}
py=
{
5
}
>
{
item
.
obj
===
'Human'
&&
<
HumanChatCard
item=
{
item
}
index=
{
index
}
/>
}
{
item
.
obj
===
'AI'
&&
(
{
item
.
obj
===
'AI'
&&
(
<>
<>
<
Flex
w=
{
'100%'
}
alignItems=
{
'center'
}
>
<
Flex
w=
{
'100%'
}
alignItems=
{
'center'
}
>
...
...
projects/app/src/web/common/hooks/useSpeech.ts
View file @
2c6dbe13
...
@@ -78,7 +78,7 @@ export const useSpeech = (props?: { shareId?: string }) => {
...
@@ -78,7 +78,7 @@ export const useSpeech = (props?: { shareId?: string }) => {
const
duration
=
Math
.
round
((
Date
.
now
()
-
startTimestamp
.
current
)
/
1000
);
const
duration
=
Math
.
round
((
Date
.
now
()
-
startTimestamp
.
current
)
/
1000
);
formData
.
append
(
'file
s
'
,
blob
,
'recording.webm'
);
formData
.
append
(
'file'
,
blob
,
'recording.webm'
);
formData
.
append
(
'metadata'
,
JSON
.
stringify
({
duration
,
shareId
}));
formData
.
append
(
'metadata'
,
JSON
.
stringify
({
duration
,
shareId
}));
setIsTransCription
(
true
);
setIsTransCription
(
true
);
...
...
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