mr-memory 2.18.3 → 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 +6 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mr-memory",
3
- "version": "2.18.3",
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
 
@@ -430,14 +431,16 @@ export async function runUpload(params: {
430
431
  return;
431
432
  }
432
433
 
433
- // 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;
434
437
  const batches: MemoryLine[][] = [];
435
438
  let currentBatch: MemoryLine[] = [];
436
439
  let currentBytes = 0;
437
440
 
438
441
  for (const line of allLines) {
439
442
  const lineBytes = JSON.stringify(line).length + 1;
440
- if (currentBytes + lineBytes > MAX_BATCH_BYTES || currentBatch.length >= MAX_BATCH_COUNT) {
443
+ if (currentBytes + lineBytes > MAX_BATCH_BYTES || currentBatch.length >= maxBatchCount) {
441
444
  if (currentBatch.length > 0) batches.push(currentBatch);
442
445
  currentBatch = [line];
443
446
  currentBytes = lineBytes;