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

@@ -410,10 +410,12 @@ export class KhojChatModal extends Modal {
if (response.status === 200) {
console.log(response);
chatInput.value += response.json.text;
} else if (response.status === 422) {
throw new Error("⛔️ Failed to transcribe audio");
} else {
} else if (response.status === 501) {
throw new Error("⛔️ Configure speech-to-text model on server.");
} else if (response.status === 422) {
throw new Error("⛔️ Audio file to large to process.");
} else {
throw new Error("⛔️ Failed to transcribe audio.");
}
};