@mulingai-npm/redis 3.40.21 → 3.40.22
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.
|
@@ -67,8 +67,11 @@ class SmartTranslateContextManager {
|
|
|
67
67
|
existing[existingIdx] = entry;
|
|
68
68
|
const pipe = this.redisClient.pipeline();
|
|
69
69
|
pipe.del(key);
|
|
70
|
-
//
|
|
71
|
-
|
|
70
|
+
// existing is chronological (oldest→newest). LPUSH adds to head.
|
|
71
|
+
// Push oldest first so newest ends up at head, matching the read-time
|
|
72
|
+
// contract where lrange(0,N-1) returns head-first (newest→oldest) and
|
|
73
|
+
// getContext() reverses to return chronological order.
|
|
74
|
+
for (let i = 0; i < existing.length; i++) {
|
|
72
75
|
pipe.lpush(key, JSON.stringify(existing[i]));
|
|
73
76
|
}
|
|
74
77
|
pipe.ltrim(key, 0, MAX_CONTEXT_CHUNKS - 1);
|