Skip to content

Commit 2c6dbe1

Browse files
authored
fix: retry input and whisper (#785)
1 parent 3181166 commit 2c6dbe1

File tree

2 files changed

+32
-38
lines changed

2 files changed

+32
-38
lines changed

projects/app/src/components/ChatBox/index.tsx

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -586,42 +586,6 @@ const ChatBox = (
586586
},
587587
[onUpdateVariable]
588588
);
589-
const HumanChatCard = useCallback(
590-
({ item, index }: { item: ChatSiteItemType; index: number }) => {
591-
return (
592-
<>
593-
{/* control icon */}
594-
<Flex w={'100%'} alignItems={'center'} justifyContent={'flex-end'}>
595-
<ChatControllerComponent
596-
chat={item}
597-
onDelete={
598-
onDelMessage
599-
? () => {
600-
delOneMessage({ dataId: item.dataId, index });
601-
}
602-
: undefined
603-
}
604-
onRetry={useCallback(() => retryInput(index), [index])}
605-
/>
606-
<ChatAvatar src={userAvatar} type={'Human'} />
607-
</Flex>
608-
{/* content */}
609-
<Box mt={['6px', 2]} textAlign={'right'}>
610-
<Card
611-
className="markdown"
612-
{...MessageCardStyle}
613-
bg={'primary.200'}
614-
borderRadius={'8px 0 8px 8px'}
615-
textAlign={'left'}
616-
>
617-
<Markdown source={item.value} isChatting={false} />
618-
</Card>
619-
</Box>
620-
</>
621-
);
622-
},
623-
[]
624-
);
625589

626590
return (
627591
<Flex flexDirection={'column'} h={'100%'}>
@@ -645,7 +609,37 @@ const ChatBox = (
645609
<Box id={'history'}>
646610
{chatHistory.map((item, index) => (
647611
<Box key={item.dataId} py={5}>
648-
{item.obj === 'Human' && <HumanChatCard item={item} index={index} />}
612+
{item.obj === 'Human' && (
613+
<>
614+
{/* control icon */}
615+
<Flex w={'100%'} alignItems={'center'} justifyContent={'flex-end'}>
616+
<ChatControllerComponent
617+
chat={item}
618+
onDelete={
619+
onDelMessage
620+
? () => {
621+
delOneMessage({ dataId: item.dataId, index });
622+
}
623+
: undefined
624+
}
625+
onRetry={() => retryInput(index)}
626+
/>
627+
<ChatAvatar src={userAvatar} type={'Human'} />
628+
</Flex>
629+
{/* content */}
630+
<Box mt={['6px', 2]} textAlign={'right'}>
631+
<Card
632+
className="markdown"
633+
{...MessageCardStyle}
634+
bg={'primary.200'}
635+
borderRadius={'8px 0 8px 8px'}
636+
textAlign={'left'}
637+
>
638+
<Markdown source={item.value} isChatting={false} />
639+
</Card>
640+
</Box>
641+
</>
642+
)}
649643
{item.obj === 'AI' && (
650644
<>
651645
<Flex w={'100%'} alignItems={'center'}>

projects/app/src/web/common/hooks/useSpeech.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export const useSpeech = (props?: { shareId?: string }) => {
7878

7979
const duration = Math.round((Date.now() - startTimestamp.current) / 1000);
8080

81-
formData.append('files', blob, 'recording.webm');
81+
formData.append('file', blob, 'recording.webm');
8282
formData.append('metadata', JSON.stringify({ duration, shareId }));
8383

8484
setIsTransCription(true);

0 commit comments

Comments
 (0)