fix: show memory index counts in progress
This commit is contained in:
@@ -145,6 +145,7 @@ describe("memory embedding batches", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(updates.length).toBeGreaterThan(0);
|
expect(updates.length).toBeGreaterThan(0);
|
||||||
|
expect(updates.some((update) => update.label?.includes("/"))).toBe(true);
|
||||||
const last = updates[updates.length - 1];
|
const last = updates[updates.length - 1];
|
||||||
expect(last?.total).toBeGreaterThan(0);
|
expect(last?.total).toBeGreaterThan(0);
|
||||||
expect(last?.completed).toBe(last?.total);
|
expect(last?.completed).toBe(last?.total);
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ type MemorySyncProgressUpdate = {
|
|||||||
type MemorySyncProgressState = {
|
type MemorySyncProgressState = {
|
||||||
completed: number;
|
completed: number;
|
||||||
total: number;
|
total: number;
|
||||||
|
label?: string;
|
||||||
report: (update: MemorySyncProgressUpdate) => void;
|
report: (update: MemorySyncProgressUpdate) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -799,7 +800,24 @@ export class MemoryIndexManager {
|
|||||||
progress?: (update: MemorySyncProgressUpdate) => void;
|
progress?: (update: MemorySyncProgressUpdate) => void;
|
||||||
}) {
|
}) {
|
||||||
const progress: MemorySyncProgressState | null = params?.progress
|
const progress: MemorySyncProgressState | null = params?.progress
|
||||||
? { completed: 0, total: 0, report: params.progress }
|
? {
|
||||||
|
completed: 0,
|
||||||
|
total: 0,
|
||||||
|
label: undefined,
|
||||||
|
report: (update) => {
|
||||||
|
if (!params.progress) return;
|
||||||
|
if (update.label) progress.label = update.label;
|
||||||
|
const label =
|
||||||
|
update.total > 0 && progress.label
|
||||||
|
? `${progress.label} ${update.completed}/${update.total}`
|
||||||
|
: progress.label;
|
||||||
|
params.progress({
|
||||||
|
completed: update.completed,
|
||||||
|
total: update.total,
|
||||||
|
label,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
: null;
|
: null;
|
||||||
const vectorReady = await this.ensureVectorReady();
|
const vectorReady = await this.ensureVectorReady();
|
||||||
const meta = this.readMeta();
|
const meta = this.readMeta();
|
||||||
|
|||||||
Reference in New Issue
Block a user