mr-memory 2.18.2 → 2.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/upload.ts +8 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mr-memory",
3
- "version": "2.18.2",
3
+ "version": "2.18.4",
4
4
  "description": "MemoryRouter persistent memory plugin for OpenClaw — your AI remembers every conversation",
5
5
  "type": "module",
6
6
  "files": [
package/upload.ts CHANGED
@@ -143,7 +143,8 @@ type MemoryLine = {
143
143
  const MAX_ITEM_CHARS = 8000;
144
144
  const TARGET_CHUNK_CHARS = 4000;
145
145
  const MAX_BATCH_BYTES = 2_000_000;
146
- const MAX_BATCH_COUNT = 100;
146
+ const MAX_BATCH_COUNT_DEFAULT = 100;
147
+ const MAX_BATCH_COUNT_QWEN = 25;
147
148
  const BATCH_SLEEP_MS = 150;
148
149
  const MAX_HTTP_RETRIES = 3;
149
150
 
@@ -402,7 +403,8 @@ export async function runUpload(params: {
402
403
  return;
403
404
  }
404
405
 
405
- console.log(`Uploading ${files.length} files to MemoryRouter...`);
406
+ const modelLabel = embeddings ? `(model: ${embeddings})` : "(model: bge)";
407
+ console.log(`Uploading ${files.length} files to MemoryRouter ${modelLabel}...`);
406
408
 
407
409
  const allLines: MemoryLine[] = [];
408
410
  let skippedEmpty = 0;
@@ -429,14 +431,16 @@ export async function runUpload(params: {
429
431
  return;
430
432
  }
431
433
 
432
- // Batch
434
+ // Batch — smaller batches for Qwen (4096-dim vectors are 4x heavier)
435
+ const isQwen = embeddings && ['qwen', 'qwen3', 'qwen3-8b', 'qwen3-embedding', 'qwen3-embedding-8b'].includes(embeddings.toLowerCase());
436
+ const maxBatchCount = isQwen ? MAX_BATCH_COUNT_QWEN : MAX_BATCH_COUNT_DEFAULT;
433
437
  const batches: MemoryLine[][] = [];
434
438
  let currentBatch: MemoryLine[] = [];
435
439
  let currentBytes = 0;
436
440
 
437
441
  for (const line of allLines) {
438
442
  const lineBytes = JSON.stringify(line).length + 1;
439
- if (currentBytes + lineBytes > MAX_BATCH_BYTES || currentBatch.length >= MAX_BATCH_COUNT) {
443
+ if (currentBytes + lineBytes > MAX_BATCH_BYTES || currentBatch.length >= maxBatchCount) {
440
444
  if (currentBatch.length > 0) batches.push(currentBatch);
441
445
  currentBatch = [line];
442
446
  currentBytes = lineBytes;