mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 22:03:54 +00:00
fix: retry input and whisper (#785)
This commit is contained in:
@@ -586,42 +586,6 @@ const ChatBox = (
|
|||||||
},
|
},
|
||||||
[onUpdateVariable]
|
[onUpdateVariable]
|
||||||
);
|
);
|
||||||
const HumanChatCard = useCallback(
|
|
||||||
({ item, index }: { item: ChatSiteItemType; index: number }) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{/* control icon */}
|
|
||||||
<Flex w={'100%'} alignItems={'center'} justifyContent={'flex-end'}>
|
|
||||||
<ChatControllerComponent
|
|
||||||
chat={item}
|
|
||||||
onDelete={
|
|
||||||
onDelMessage
|
|
||||||
? () => {
|
|
||||||
delOneMessage({ dataId: item.dataId, index });
|
|
||||||
}
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
onRetry={useCallback(() => retryInput(index), [index])}
|
|
||||||
/>
|
|
||||||
<ChatAvatar src={userAvatar} type={'Human'} />
|
|
||||||
</Flex>
|
|
||||||
{/* content */}
|
|
||||||
<Box mt={['6px', 2]} textAlign={'right'}>
|
|
||||||
<Card
|
|
||||||
className="markdown"
|
|
||||||
{...MessageCardStyle}
|
|
||||||
bg={'primary.200'}
|
|
||||||
borderRadius={'8px 0 8px 8px'}
|
|
||||||
textAlign={'left'}
|
|
||||||
>
|
|
||||||
<Markdown source={item.value} isChatting={false} />
|
|
||||||
</Card>
|
|
||||||
</Box>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex flexDirection={'column'} h={'100%'}>
|
<Flex flexDirection={'column'} h={'100%'}>
|
||||||
@@ -645,7 +609,37 @@ const ChatBox = (
|
|||||||
<Box id={'history'}>
|
<Box id={'history'}>
|
||||||
{chatHistory.map((item, index) => (
|
{chatHistory.map((item, index) => (
|
||||||
<Box key={item.dataId} py={5}>
|
<Box key={item.dataId} py={5}>
|
||||||
{item.obj === 'Human' && <HumanChatCard item={item} index={index} />}
|
{item.obj === 'Human' && (
|
||||||
|
<>
|
||||||
|
{/* control icon */}
|
||||||
|
<Flex w={'100%'} alignItems={'center'} justifyContent={'flex-end'}>
|
||||||
|
<ChatControllerComponent
|
||||||
|
chat={item}
|
||||||
|
onDelete={
|
||||||
|
onDelMessage
|
||||||
|
? () => {
|
||||||
|
delOneMessage({ dataId: item.dataId, index });
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
onRetry={() => retryInput(index)}
|
||||||
|
/>
|
||||||
|
<ChatAvatar src={userAvatar} type={'Human'} />
|
||||||
|
</Flex>
|
||||||
|
{/* content */}
|
||||||
|
<Box mt={['6px', 2]} textAlign={'right'}>
|
||||||
|
<Card
|
||||||
|
className="markdown"
|
||||||
|
{...MessageCardStyle}
|
||||||
|
bg={'primary.200'}
|
||||||
|
borderRadius={'8px 0 8px 8px'}
|
||||||
|
textAlign={'left'}
|
||||||
|
>
|
||||||
|
<Markdown source={item.value} isChatting={false} />
|
||||||
|
</Card>
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{item.obj === 'AI' && (
|
{item.obj === 'AI' && (
|
||||||
<>
|
<>
|
||||||
<Flex w={'100%'} alignItems={'center'}>
|
<Flex w={'100%'} alignItems={'center'}>
|
||||||
|
@@ -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('files', 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);
|
||||||
|
Reference in New Issue
Block a user