mr-memory 2.11.3 → 2.11.5
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.
- package/package.json +1 -1
- package/upload.ts +12 -2
package/package.json
CHANGED
package/upload.ts
CHANGED
|
@@ -14,7 +14,7 @@ type MemoryLine = {
|
|
|
14
14
|
const MAX_ITEM_CHARS = 8000;
|
|
15
15
|
const TARGET_CHUNK_CHARS = 4000;
|
|
16
16
|
const MAX_BATCH_BYTES = 2_000_000;
|
|
17
|
-
const MAX_BATCH_COUNT =
|
|
17
|
+
const MAX_BATCH_COUNT = 25;
|
|
18
18
|
const BATCH_SLEEP_MS = 150;
|
|
19
19
|
const MAX_HTTP_RETRIES = 3;
|
|
20
20
|
|
|
@@ -123,7 +123,17 @@ async function sessionToJsonl(filePath: string): Promise<MemoryLine[]> {
|
|
|
123
123
|
timestamp = Date.now();
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
const trimmedText = text.trim();
|
|
127
|
+
|
|
128
|
+
// Chunk oversized messages to avoid blowing up the embedding service
|
|
129
|
+
if (trimmedText.length > MAX_ITEM_CHARS) {
|
|
130
|
+
const chunks = chunkText(trimmedText, TARGET_CHUNK_CHARS);
|
|
131
|
+
for (const chunk of chunks) {
|
|
132
|
+
lines.push({ content: chunk, role: msg.role, timestamp });
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
lines.push({ content: trimmedText, role: msg.role, timestamp });
|
|
136
|
+
}
|
|
127
137
|
} catch {
|
|
128
138
|
// Skip invalid lines
|
|
129
139
|
}
|