@assistant-ui/react 0.5.84 → 0.5.85
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -4651,7 +4651,14 @@ var LocalThreadRuntimeCore = (_class12 = class extends BaseThreadRuntimeCore {
|
|
4651
4651
|
var LocalThreadManagerRuntimeCore = (_class13 = class {
|
4652
4652
|
constructor(_threadFactory) {;_class13.prototype.__init31.call(this);_class13.prototype.__init32.call(this);_class13.prototype.__init33.call(this);_class13.prototype.__init34.call(this);
|
4653
4653
|
this._threadFactory = _threadFactory;
|
4654
|
-
|
4654
|
+
const threadId = generateId();
|
4655
|
+
this._threadData.set(threadId, {
|
4656
|
+
data: { messages: [] },
|
4657
|
+
metadata: { threadId },
|
4658
|
+
isArchived: false
|
4659
|
+
});
|
4660
|
+
this._threads = [{ threadId }];
|
4661
|
+
this._mainThread = this._threadFactory(threadId, { messages: [] });
|
4655
4662
|
}
|
4656
4663
|
__init31() {this._threadData = /* @__PURE__ */ new Map()}
|
4657
4664
|
__init32() {this._threads = []}
|
@@ -4674,17 +4681,21 @@ var LocalThreadManagerRuntimeCore = (_class13 = class {
|
|
4674
4681
|
this._performThreadSwitch(thread);
|
4675
4682
|
}
|
4676
4683
|
switchToNewThread() {
|
4677
|
-
|
4678
|
-
|
4684
|
+
const threadId = generateId();
|
4685
|
+
this._threadData.set(threadId, {
|
4686
|
+
data: { messages: [] },
|
4687
|
+
metadata: { threadId },
|
4688
|
+
isArchived: false
|
4689
|
+
});
|
4690
|
+
this._threads = [{ threadId }];
|
4691
|
+
const thread = this._threadFactory(threadId, { messages: [] });
|
4679
4692
|
this._performThreadSwitch(thread);
|
4680
4693
|
}
|
4681
4694
|
_performThreadSwitch(newThreadCore) {
|
4682
|
-
|
4683
|
-
|
4684
|
-
|
4685
|
-
|
4686
|
-
data.data = exprt;
|
4687
|
-
}
|
4695
|
+
const data = this._threadData.get(this._mainThread.threadId);
|
4696
|
+
if (!data) throw new Error("Thread not found");
|
4697
|
+
const exprt = this._mainThread.export();
|
4698
|
+
data.data = exprt;
|
4688
4699
|
this._mainThread._notifyEventSubscribers("switched-away");
|
4689
4700
|
this._mainThread = newThreadCore;
|
4690
4701
|
newThreadCore._notifyEventSubscribers("switched-to");
|