@mastra/clickhouse 1.25.0 → 1.25.1-alpha.0
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/dist/index.js
CHANGED
|
@@ -942,12 +942,23 @@ var MemoryStorageClickhouse = class extends MemoryStorage {
|
|
|
942
942
|
query_params: { messageIds }
|
|
943
943
|
});
|
|
944
944
|
if (threadIds.length > 0) {
|
|
945
|
-
const now =
|
|
946
|
-
await this.
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
945
|
+
const now = Date.now();
|
|
946
|
+
const existingThreads = await this.getLatestThreads(threadIds);
|
|
947
|
+
if (existingThreads.size > 0) await this.client.insert({
|
|
948
|
+
table: TABLE_THREADS,
|
|
949
|
+
format: "JSONEachRow",
|
|
950
|
+
values: Array.from(existingThreads.values()).map((existingThread) => ({
|
|
951
|
+
id: existingThread.id,
|
|
952
|
+
resourceId: existingThread.resourceId,
|
|
953
|
+
title: existingThread.title,
|
|
954
|
+
metadata: serializeMetadata(existingThread.metadata),
|
|
955
|
+
createdAt: existingThread.createdAt,
|
|
956
|
+
updatedAt: new Date(Math.max(now, new Date(existingThread.updatedAt).getTime() + 1)).toISOString().replace("Z", "")
|
|
957
|
+
})),
|
|
958
|
+
clickhouse_settings: {
|
|
959
|
+
date_time_input_format: "best_effort",
|
|
960
|
+
use_client_time_zone: 1,
|
|
961
|
+
output_format_json_quote_64bit_integers: 0
|
|
951
962
|
}
|
|
952
963
|
});
|
|
953
964
|
}
|