@flytedan/flytebot-design-system 0.71.3 → 0.71.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/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12439,6 +12439,8 @@ function useChatEngine(opts) {
|
|
|
12439
12439
|
const serverCount = React70.useRef(0);
|
|
12440
12440
|
const serverIds = React70.useRef(/* @__PURE__ */ new Set());
|
|
12441
12441
|
const liveTurn = React70.useRef(null);
|
|
12442
|
+
const lastTurnOwn = React70.useRef(/* @__PURE__ */ new Set());
|
|
12443
|
+
const retired = React70.useRef(/* @__PURE__ */ new Set());
|
|
12442
12444
|
const threadRef = React70.useRef(null);
|
|
12443
12445
|
const mounted = React70.useRef(true);
|
|
12444
12446
|
React70.useEffect(() => {
|
|
@@ -12476,18 +12478,24 @@ function useChatEngine(opts) {
|
|
|
12476
12478
|
const server = data && data.messages || [];
|
|
12477
12479
|
const turn = liveTurn.current;
|
|
12478
12480
|
const ownIds = /* @__PURE__ */ new Set();
|
|
12479
|
-
|
|
12481
|
+
const ownAssistants = [];
|
|
12480
12482
|
if (turn) {
|
|
12481
12483
|
for (const m of server) {
|
|
12482
12484
|
if (turn.known.has(m.id)) continue;
|
|
12483
12485
|
ownIds.add(m.id);
|
|
12484
|
-
if (m.role === "assistant")
|
|
12486
|
+
if (m.role === "assistant") ownAssistants.push(m);
|
|
12485
12487
|
}
|
|
12486
12488
|
}
|
|
12489
|
+
const progress = ownAssistants.pop();
|
|
12490
|
+
const cards = ownAssistants;
|
|
12487
12491
|
const ids = new Set(server.map((m) => m.id));
|
|
12488
12492
|
serverCount.current = server.length;
|
|
12489
12493
|
serverIds.current = ids;
|
|
12490
|
-
const
|
|
12494
|
+
const settled = server.filter((m) => !ownIds.has(m.id) && !retired.current.has(m.id));
|
|
12495
|
+
const local = listRef.current.filter((m) => !ids.has(m.id));
|
|
12496
|
+
const at = local.findIndex((m) => m.id === turn?.holderId);
|
|
12497
|
+
const tail = at < 0 ? [...cards, ...local] : [...local.slice(0, at), ...cards, ...local.slice(at)];
|
|
12498
|
+
const next = [...settled, ...tail];
|
|
12491
12499
|
commit(turn && progress ? next.map((m) => m.id === turn.holderId ? foldProgress(m, progress) : m) : next);
|
|
12492
12500
|
}
|
|
12493
12501
|
function foldProgress(holder, progress) {
|
|
@@ -12706,6 +12714,8 @@ function useChatEngine(opts) {
|
|
|
12706
12714
|
commit(listRef.current.filter((m) => m.id !== holderId));
|
|
12707
12715
|
}
|
|
12708
12716
|
} finally {
|
|
12717
|
+
const known = liveTurn.current.known;
|
|
12718
|
+
lastTurnOwn.current = new Set([...serverIds.current].filter((id2) => !known.has(id2)));
|
|
12709
12719
|
liveTurn.current = null;
|
|
12710
12720
|
abortRef.current = null;
|
|
12711
12721
|
busyRef.current = false;
|
|
@@ -12767,6 +12777,7 @@ function useChatEngine(opts) {
|
|
|
12767
12777
|
const turn = list[at];
|
|
12768
12778
|
commit(list.slice(0, at));
|
|
12769
12779
|
serverCount.current = Math.max(0, serverCount.current - 1);
|
|
12780
|
+
lastTurnOwn.current.forEach((id) => retired.current.add(id));
|
|
12770
12781
|
stoppedRef.current = false;
|
|
12771
12782
|
queueRef.current = [{ id: uid("q"), text: turn.text || "", attachments: turn.attachments }].concat(queueRef.current);
|
|
12772
12783
|
setQueue(queueRef.current.slice());
|