diff --git a/index.html b/index.html
index 578a0f1..0196b9a 100644
--- a/index.html
+++ b/index.html
@@ -37,7 +37,10 @@
Text-to-Audio Converter
-
+
+
+
An error occured calling the OpenAI API:
Are you sure that the entered key is valid and that there is enough credit balance on your account?
+
Converting...
diff --git a/main.js b/main.js
index ba5b723..577efc6 100644
--- a/main.js
+++ b/main.js
@@ -85,6 +85,7 @@ function generateAudiobook() {
var segments = splitTextIntoSegments(text, 4000);
var audioBlobs = new Array(segments.length);
var progressBar = document.getElementById('progressbar1');
+ document.getElementById('error-indicator').style.display = 'none';
progressBar.max = segments.length;
progressBar.value = 0;
@@ -150,6 +151,7 @@ function callOpenAIAPI(segment, apiKey, callback) {
callback(audioBlob);
} else {
console.error("Error calling OpenAI API: " + xhr.statusText);
+ document.getElementById('error-indicator').style.display = 'block';
}
};