Throw unsupported error when server not configured for image, speech-to-text

This commit is contained in:
Debanjum Singh Solanky
2023-12-05 01:29:36 -05:00
parent 8f2f053968
commit 162b219f2b
5 changed files with 23 additions and 13 deletions

View File

@@ -675,9 +675,13 @@
.then(response => response.ok ? response.json() : Promise.reject(response))
.then(data => { chatInput.value += data.text; })
.catch(err => {
err.status == 422
? flashStatusInChatInput("⛔️ Configure speech-to-text model on server.")
: flashStatusInChatInput("⛔️ Failed to transcribe audio")
if (err.status === 501) {
flashStatusInChatInput("⛔️ Configure speech-to-text model on server.")
} else if (err.status === 422) {
flashStatusInChatInput("⛔️ Audio file to large to process.")
} else {
flashStatusInChatInput("⛔️ Failed to transcribe audio.")
}
});
};