From 2c6dbe13d96a2af058c0b21cf4bad1c297820eac Mon Sep 17 00:00:00 2001
From: Archer <545436317@qq.com>
Date: Thu, 25 Jan 2024 15:41:29 +0800
Subject: [PATCH] fix: retry input and whisper (#785)
---
projects/app/src/components/ChatBox/index.tsx | 68 +++++++++----------
.../app/src/web/common/hooks/useSpeech.ts | 2 +-
2 files changed, 32 insertions(+), 38 deletions(-)
diff --git a/projects/app/src/components/ChatBox/index.tsx b/projects/app/src/components/ChatBox/index.tsx
index 6683f1de148..e4becdc662f 100644
--- a/projects/app/src/components/ChatBox/index.tsx
+++ b/projects/app/src/components/ChatBox/index.tsx
@@ -586,42 +586,6 @@ const ChatBox = (
},
[onUpdateVariable]
);
- const HumanChatCard = useCallback(
- ({ item, index }: { item: ChatSiteItemType; index: number }) => {
- return (
- <>
- {/* control icon */}
-
- {
- delOneMessage({ dataId: item.dataId, index });
- }
- : undefined
- }
- onRetry={useCallback(() => retryInput(index), [index])}
- />
-
-
- {/* content */}
-
-
-
-
-
- >
- );
- },
- []
- );
return (
@@ -645,7 +609,37 @@ const ChatBox = (
{chatHistory.map((item, index) => (
- {item.obj === 'Human' && }
+ {item.obj === 'Human' && (
+ <>
+ {/* control icon */}
+
+ {
+ delOneMessage({ dataId: item.dataId, index });
+ }
+ : undefined
+ }
+ onRetry={() => retryInput(index)}
+ />
+
+
+ {/* content */}
+
+
+
+
+
+ >
+ )}
{item.obj === 'AI' && (
<>
diff --git a/projects/app/src/web/common/hooks/useSpeech.ts b/projects/app/src/web/common/hooks/useSpeech.ts
index 3a90f0ce47e..fd54a576dae 100644
--- a/projects/app/src/web/common/hooks/useSpeech.ts
+++ b/projects/app/src/web/common/hooks/useSpeech.ts
@@ -78,7 +78,7 @@ export const useSpeech = (props?: { shareId?: string }) => {
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 }));
setIsTransCription(true);