diff --git a/templates/interviews/interview_detail.html b/templates/interviews/interview_detail.html
index b098c8c..cc9e760 100644
--- a/templates/interviews/interview_detail.html
+++ b/templates/interviews/interview_detail.html
@@ -526,7 +526,7 @@
@@ -1089,5 +1089,33 @@ async function copyJoinUrl(){
}
}
+document.addEventListener('DOMContentLoaded', function() {
+ const aiForm = document.getElementById('aiGenForm');
+ const aiBtn = document.getElementById('aiGenBtn');
+ const aiMainToggle = document.getElementById('aiDropdown');
+
+ if (aiForm) {
+ aiForm.addEventListener('submit', function() {
+ // 1. Disable the button to prevent multiple requests
+ aiBtn.disabled = true;
+
+ // 2. Change the inner HTML to show a spinner
+ aiBtn.innerHTML = `
+
+ {% trans "Generating..." %}
+ `;
+
+ // 3. Update the main visible toggle button to show loading state too
+ if (aiMainToggle) {
+ aiMainToggle.classList.add('disabled');
+ aiMainToggle.innerHTML = `
+
+ {% trans "AI Working..." %}
+ `;
+ }
+ });
+ }
+});
+
{% endblock %}