try fetch whsiper API
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user