v0.0.34: вывод токенов и времени LLM в UI (суммарно за прогон)
Deploy drhider / validate (push) Canceled after 0s

This commit is contained in:
“Naeel”
2026-08-19 09:00:40 +04:00
parent 53a1fb40d2
commit 02d9592eb5
5 changed files with 88 additions and 7 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ if _sys_path_root not in sys.path:
sys.path.insert(0, _sys_path_root)
# Версия приложения (меняется при изменениях)
VERSION = "0.0.33"
VERSION = "0.0.34"
def create_app():
+10 -3
View File
@@ -87,7 +87,11 @@ def process_stream(sid):
zip_data, csv_str = obfuscate_files(
all_files, llm_client=llm, progress_cb=progress
)
q.put(("result", zip_data, csv_str))
stats = {
"tokens": llm.tokens_total,
"llm_sec": round(llm.llm_sec, 1),
}
q.put(("result", zip_data, csv_str, stats))
except Exception as e:
q.put(("error", repr(e)))
@@ -115,7 +119,7 @@ def process_stream(sid):
return
elif kind == "result":
_, zip_data, csv_str = evt
_, zip_data, csv_str, stats = evt
store_result(sid, zip_data)
if csv_str:
store_csv(sid, csv_str)
@@ -123,7 +127,10 @@ def process_stream(sid):
with zipfile.ZipFile(io.BytesIO(zip_data)) as zf:
count = len([n for n in zf.namelist() if n != "mapping.csv"])
try:
yield f"event: complete\ndata: {json.dumps({'total': count})}\n\n"
yield (
f"event: complete\n"
f"data: {json.dumps({'total': count, **stats})}\n\n"
)
except _disconnect_exceptions():
return
return
+7 -1
View File
@@ -404,8 +404,14 @@ async function uploadFiles() {
activeES = null;
clearInterval(ptimer);
const d = JSON.parse(e.data);
const totalSec = ((performance.now() - t0) / 1000).toFixed(1);
let msg = '✅ Обработано ' + d.total + ' файлов за ' + totalSec + 'с';
if (d.llm_sec > 0) {
msg += ' · LLM: ' + d.llm_sec + 'с';
if (d.tokens > 0) msg += ' · ' + d.tokens + ' токенов';
}
st.className = 'status done';
st.textContent = '✅ Обработано ' + d.total + ' файлов за ' + ((performance.now() - t0) / 1000).toFixed(1) + 'с';
st.textContent = msg;
db.classList.add('show');
resolve();
});