try fetch whsiper API

This commit is contained in:
2023-08-25 18:56:34 +08:00
parent 603d1653b3
commit 75d5291589

View File

@@ -571,6 +571,7 @@ export default function ChatBOX(props: {
}); });
reader.onloadend = async () => { reader.onloadend = async () => {
try {
const base64data = reader.result; const base64data = reader.result;
// post to openai whisper api // post to openai whisper api
@@ -594,7 +595,12 @@ export default function ChatBOX(props: {
const { text } = await response.json(); const { text } = await response.json();
setInputMsg(inputMsg ? inputMsg + " " + text : text); setInputMsg(inputMsg ? inputMsg + " " + text : text);
} catch (error) {
alert(error);
console.log(error);
} finally {
setIsRecording("Mic"); setIsRecording("Mic");
}
}; };
}); });
} catch (error) { } catch (error) {