diff --git a/src/yolo_webui/static/app.js b/src/yolo_webui/static/app.js index 9163521..632499c 100755 --- a/src/yolo_webui/static/app.js +++ b/src/yolo_webui/static/app.js @@ -250,6 +250,14 @@ document.addEventListener('DOMContentLoaded', () => { mlflowEnabled.addEventListener('change', updateMlflowFields); // --- Logger --- + function scrollToLogBottom(container) { + if (!container) return; + container.scrollTop = container.scrollHeight; + if (container.lastElementChild && container.lastElementChild.scrollIntoView) { + container.lastElementChild.scrollIntoView({ block: 'end' }); + } + } + function addLogLine(message, level = 'info') { const line = document.createElement('div'); line.className = `log-line log-level-${level.toLowerCase()}`; @@ -257,7 +265,7 @@ document.addEventListener('DOMContentLoaded', () => { logContainer.appendChild(line); if (autoscrollCheck.checked) { - logContainer.scrollTop = logContainer.scrollHeight; + scrollToLogBottom(logContainer); } } @@ -381,7 +389,7 @@ document.addEventListener('DOMContentLoaded', () => { addLogLine(data.message, data.level); } if (autoscrollCheck && autoscrollCheck.checked) { - logContainer.scrollTop = logContainer.scrollHeight; + scrollToLogBottom(logContainer); } } else if (data.type === 'progress') { updateProgress(data.epoch, data.total_epochs, data.message); @@ -1024,7 +1032,7 @@ document.addEventListener('DOMContentLoaded', () => { exportLogContainer.appendChild(line); if (exportAutoscrollCheck.checked) { - exportLogContainer.scrollTop = exportLogContainer.scrollHeight; + scrollToLogBottom(exportLogContainer); } } diff --git a/src/yolo_webui/static/index.html b/src/yolo_webui/static/index.html index b8b95b8..48890c5 100755 --- a/src/yolo_webui/static/index.html +++ b/src/yolo_webui/static/index.html @@ -8,7 +8,7 @@ - +