feat: progress reporting during corpus embedding

Emit a `… embedded N/total (pct%)` line every 1000 items (and at
completion) so a full --confirm run is observable rather than silent
for its full duration.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 18:00:08 +02:00
parent f047cd1b5b
commit 1f4607ced1
+7
View File
@@ -72,9 +72,16 @@ pub fn build_corpus_embeddings(
.filter(|t| !store.has(t))
.cloned()
.collect();
let total = pending.len();
let mut done = 0;
let mut last_report = 0;
for chunk in pending.chunks(batch.max(1)) {
done += embed_batch(client, store, model, chunk)?;
if done - last_report >= 1000 || done == total {
let pct = if total == 0 { 100.0 } else { 100.0 * done as f64 / total as f64 };
eprintln!(" … embedded {done}/{total} ({pct:.1}%)");
last_report = done;
}
}
Ok(done)
}