Refresh fix.
This commit is contained in:
@@ -605,6 +605,21 @@
|
||||
fetchLog();
|
||||
{% endif %}
|
||||
|
||||
function showRefiningModal() {
|
||||
if (!document.getElementById('refineProgressModal')) {
|
||||
const modalHtml = `
|
||||
<div class="modal fade" id="refineProgressModal" tabindex="-1" data-bs-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered"><div class="modal-content"><div class="modal-body text-center p-4">
|
||||
<div class="spinner-border text-warning mb-3" style="width: 3rem; height: 3rem;"></div>
|
||||
<h4>Refining Bible...</h4><p class="text-muted">The AI is processing your changes.</p>
|
||||
</div></div></div>
|
||||
</div>`;
|
||||
document.body.insertAdjacentHTML('beforeend', modalHtml);
|
||||
}
|
||||
const modal = new bootstrap.Modal(document.getElementById('refineProgressModal'));
|
||||
modal.show();
|
||||
}
|
||||
|
||||
function submitRefineModal(event) {
|
||||
event.preventDefault();
|
||||
const form = event.target;
|
||||
@@ -628,23 +643,14 @@
|
||||
const inputModal = bootstrap.Modal.getInstance(inputModalEl);
|
||||
inputModal.hide();
|
||||
|
||||
const modalHtml = `
|
||||
<div class="modal fade" id="refineProgressModal" tabindex="-1" data-bs-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered"><div class="modal-content"><div class="modal-body text-center p-4">
|
||||
<div class="spinner-border text-warning mb-3" style="width: 3rem; height: 3rem;"></div>
|
||||
<h4>Refining Bible...</h4><p class="text-muted">The AI is processing your changes.</p>
|
||||
</div></div></div>
|
||||
</div>`;
|
||||
document.body.insertAdjacentHTML('beforeend', modalHtml);
|
||||
const progressModal = new bootstrap.Modal(document.getElementById('refineProgressModal'));
|
||||
progressModal.show();
|
||||
showRefiningModal();
|
||||
|
||||
const pollInterval = setInterval(() => {
|
||||
fetch(`/task_status/${data.task_id}`).then(r => r.json()).then(status => {
|
||||
if (status.status === 'completed') {
|
||||
clearInterval(pollInterval);
|
||||
if (status.success) {
|
||||
window.location.reload();
|
||||
window.location.href = "/project/{{ project.id }}/bible_comparison";
|
||||
} else {
|
||||
alert("Refinement failed. Please check the logs.");
|
||||
window.location.reload();
|
||||
@@ -660,5 +666,19 @@
|
||||
btn.innerHTML = originalText;
|
||||
});
|
||||
}
|
||||
|
||||
{% if is_refining %}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
showRefiningModal();
|
||||
const pollInterval = setInterval(() => {
|
||||
fetch("/project/{{ project.id }}/is_refining").then(r => r.json()).then(data => {
|
||||
if (!data.is_refining) {
|
||||
clearInterval(pollInterval);
|
||||
window.location.href = "/project/{{ project.id }}/bible_comparison";
|
||||
}
|
||||
});
|
||||
}, 2000);
|
||||
});
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user