This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ if _sys_path_root not in sys.path:
|
|||||||
sys.path.insert(0, _sys_path_root)
|
sys.path.insert(0, _sys_path_root)
|
||||||
|
|
||||||
# Версия приложения (меняется при изменениях)
|
# Версия приложения (меняется при изменениях)
|
||||||
VERSION = "0.0.8"
|
VERSION = "0.0.9"
|
||||||
|
|
||||||
|
|
||||||
def create_app():
|
def create_app():
|
||||||
|
|||||||
@@ -205,6 +205,8 @@ async function uploadFiles() {
|
|||||||
|
|
||||||
// Фаза 2: обработка (SSE — прогресс по каждому файлу)
|
// Фаза 2: обработка (SSE — прогресс по каждому файлу)
|
||||||
for (let i = 0; i < total; i++) ss(i, '<span style="color:#2563eb">⏳</span>');
|
for (let i = 0; i < total; i++) ss(i, '<span style="color:#2563eb">⏳</span>');
|
||||||
|
const fileTimers = {}; // idx -> performance.now()
|
||||||
|
const fileIntervals = {}; // idx -> setInterval id
|
||||||
st.className = 'status progress';
|
st.className = 'status progress';
|
||||||
st.textContent = 'Обработка...';
|
st.textContent = 'Обработка...';
|
||||||
const t0 = performance.now();
|
const t0 = performance.now();
|
||||||
@@ -218,11 +220,17 @@ async function uploadFiles() {
|
|||||||
const es = new EventSource('/api/process_stream/' + currentSid);
|
const es = new EventSource('/api/process_stream/' + currentSid);
|
||||||
es.addEventListener('start', function(e) {
|
es.addEventListener('start', function(e) {
|
||||||
const d = JSON.parse(e.data);
|
const d = JSON.parse(e.data);
|
||||||
ss(d.idx, '<span style="color:#2563eb">⏳ обработка</span>');
|
fileTimers[d.idx] = performance.now();
|
||||||
|
fileIntervals[d.idx] = setInterval(function() {
|
||||||
|
const elapsed = ((performance.now() - fileTimers[d.idx]) / 1000).toFixed(1);
|
||||||
|
ss(d.idx, '<span style="color:#2563eb">⏳ ' + elapsed + 'с</span>');
|
||||||
|
}, 200);
|
||||||
});
|
});
|
||||||
es.addEventListener('done', function(e) {
|
es.addEventListener('done', function(e) {
|
||||||
const d = JSON.parse(e.data);
|
const d = JSON.parse(e.data);
|
||||||
ss(d.idx, '<span style="color:#22c55e">✓</span>');
|
clearInterval(fileIntervals[d.idx]);
|
||||||
|
const elapsed = ((performance.now() - (fileTimers[d.idx] || performance.now())) / 1000).toFixed(1);
|
||||||
|
ss(d.idx, '<span style="color:#22c55e">✓ ' + elapsed + 'с</span>');
|
||||||
});
|
});
|
||||||
es.addEventListener('complete', function(e) {
|
es.addEventListener('complete', function(e) {
|
||||||
es.close();
|
es.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user