@assistant-ui/react 0.10.48 → 0.10.49
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/cloud/AssistantCloudThreadHistoryAdapter.d.ts.map +1 -1
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.js +7 -1
- package/dist/cloud/AssistantCloudThreadHistoryAdapter.js.map +1 -1
- package/dist/tests/setup.js +8 -8
- package/dist/tests/setup.js.map +1 -1
- package/package.json +1 -1
- package/src/cloud/AssistantCloudThreadHistoryAdapter.tsx +12 -1
package/package.json
CHANGED
@@ -14,6 +14,12 @@ import {
|
|
14
14
|
import { GenericThreadHistoryAdapter } from "../runtimes/adapters/thread-history/ThreadHistoryAdapter";
|
15
15
|
import { ReadonlyJSONObject } from "assistant-stream/utils";
|
16
16
|
|
17
|
+
// Global WeakMap to store message ID mappings across adapter instances
|
18
|
+
const globalMessageIdMapping = new WeakMap<
|
19
|
+
ThreadListItemRuntime,
|
20
|
+
Record<string, string | Promise<string>>
|
21
|
+
>();
|
22
|
+
|
17
23
|
class FormattedThreadHistoryAdapter<TMessage, TStorageFormat>
|
18
24
|
implements GenericThreadHistoryAdapter<TMessage>
|
19
25
|
{
|
@@ -52,7 +58,12 @@ class AssistantCloudThreadHistoryAdapter implements ThreadHistoryAdapter {
|
|
52
58
|
private threadListItemRuntime: ThreadListItemRuntime,
|
53
59
|
) {}
|
54
60
|
|
55
|
-
private _getIdForLocalId: Record<string, string | Promise<string>>
|
61
|
+
private get _getIdForLocalId(): Record<string, string | Promise<string>> {
|
62
|
+
if (!globalMessageIdMapping.has(this.threadListItemRuntime)) {
|
63
|
+
globalMessageIdMapping.set(this.threadListItemRuntime, {});
|
64
|
+
}
|
65
|
+
return globalMessageIdMapping.get(this.threadListItemRuntime)!;
|
66
|
+
}
|
56
67
|
|
57
68
|
withFormat<TMessage, TStorageFormat>(
|
58
69
|
formatAdapter: MessageFormatAdapter<TMessage, TStorageFormat>,
|