@flytedan/flytebot-design-system 0.71.1 → 0.71.3
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 +34 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5229,8 +5229,11 @@ var INLINE = [
|
|
|
5229
5229
|
["bare", /(?<![\w@/])(https?:\/\/[^\s<>()]+[^\s<>().,;:!?])/]
|
|
5230
5230
|
];
|
|
5231
5231
|
function inlineNodes(src, ctx, keyBase) {
|
|
5232
|
+
return hiddenInlineNodes(hideEscapes(String(src == null ? "" : src)), ctx, keyBase);
|
|
5233
|
+
}
|
|
5234
|
+
function hiddenInlineNodes(hidden, ctx, keyBase) {
|
|
5232
5235
|
const out = [];
|
|
5233
|
-
let rest =
|
|
5236
|
+
let rest = hidden, guard = 0;
|
|
5234
5237
|
const d = showEscapes;
|
|
5235
5238
|
const key = () => keyBase + "-" + out.length;
|
|
5236
5239
|
while (rest && guard++ < 800) {
|
|
@@ -5250,13 +5253,13 @@ function inlineNodes(src, ctx, keyBase) {
|
|
|
5250
5253
|
out.push(ctx.allowImages && src2 ? /* @__PURE__ */ jsx54("img", { className: "fd-md-img", src: src2, alt: d(g(1) || ""), title: g(3) ? d(g(3)) : void 0, loading: "lazy" }, key()) : /* @__PURE__ */ jsx54("span", { className: "fd-md-imgalt", children: d(g(1) || "image") }, key()));
|
|
5251
5254
|
} else if (kind === "link") {
|
|
5252
5255
|
const href = safeHref(d(g(2)));
|
|
5253
|
-
out.push(href ? /* @__PURE__ */ jsx54("a", { href, title: g(3) ? d(g(3)) : void 0, target: /^https?:/i.test(href) ? "_blank" : void 0, rel: "noopener noreferrer", onClick: ctx.onLinkClick, children:
|
|
5256
|
+
out.push(href ? /* @__PURE__ */ jsx54("a", { href, title: g(3) ? d(g(3)) : void 0, target: /^https?:/i.test(href) ? "_blank" : void 0, rel: "noopener noreferrer", onClick: ctx.onLinkClick, children: hiddenInlineNodes(g(1), ctx, key()) }, key()) : /* @__PURE__ */ jsx54("span", { children: d(g(1)) }, key()));
|
|
5254
5257
|
} else if (kind === "cite") {
|
|
5255
5258
|
out.push(ctx.renderCitation ? /* @__PURE__ */ jsx54(React35.Fragment, { children: ctx.renderCitation(d(g(1))) }, key()) : /* @__PURE__ */ jsx54("sup", { className: "fd-md-cite", children: d(g(1)) }, key()));
|
|
5256
|
-
} else if (kind === "strongem") out.push(/* @__PURE__ */ jsx54("strong", { children: /* @__PURE__ */ jsx54("em", { children:
|
|
5257
|
-
else if (kind === "strong") out.push(/* @__PURE__ */ jsx54("strong", { children:
|
|
5258
|
-
else if (kind === "em") out.push(/* @__PURE__ */ jsx54("em", { children:
|
|
5259
|
-
else if (kind === "del") out.push(/* @__PURE__ */ jsx54("del", { children:
|
|
5259
|
+
} else if (kind === "strongem") out.push(/* @__PURE__ */ jsx54("strong", { children: /* @__PURE__ */ jsx54("em", { children: hiddenInlineNodes(g(1), ctx, key()) }) }, key()));
|
|
5260
|
+
else if (kind === "strong") out.push(/* @__PURE__ */ jsx54("strong", { children: hiddenInlineNodes(g(1) || g(2), ctx, key()) }, key()));
|
|
5261
|
+
else if (kind === "em") out.push(/* @__PURE__ */ jsx54("em", { children: hiddenInlineNodes(g(1) || g(2), ctx, key()) }, key()));
|
|
5262
|
+
else if (kind === "del") out.push(/* @__PURE__ */ jsx54("del", { children: hiddenInlineNodes(g(1), ctx, key()) }, key()));
|
|
5260
5263
|
else if (kind === "autolink" || kind === "bare") {
|
|
5261
5264
|
const href = safeHref(d(g(1)));
|
|
5262
5265
|
out.push(href ? /* @__PURE__ */ jsx54("a", { href, target: "_blank", rel: "noopener noreferrer", onClick: ctx.onLinkClick, children: d(g(1)).replace(/^mailto:/, "") }, key()) : d(g(1)));
|
|
@@ -12434,6 +12437,8 @@ function useChatEngine(opts) {
|
|
|
12434
12437
|
const stoppedRef = React70.useRef(false);
|
|
12435
12438
|
const abortRef = React70.useRef(null);
|
|
12436
12439
|
const serverCount = React70.useRef(0);
|
|
12440
|
+
const serverIds = React70.useRef(/* @__PURE__ */ new Set());
|
|
12441
|
+
const liveTurn = React70.useRef(null);
|
|
12437
12442
|
const threadRef = React70.useRef(null);
|
|
12438
12443
|
const mounted = React70.useRef(true);
|
|
12439
12444
|
React70.useEffect(() => {
|
|
@@ -12462,15 +12467,35 @@ function useChatEngine(opts) {
|
|
|
12462
12467
|
const data = await apiAdapter.getThread(id);
|
|
12463
12468
|
const list = [...data && data.messages || []];
|
|
12464
12469
|
serverCount.current = list.length;
|
|
12470
|
+
serverIds.current = new Set(list.map((m) => m.id));
|
|
12465
12471
|
commit(list);
|
|
12466
12472
|
return list;
|
|
12467
12473
|
}, [apiAdapter]);
|
|
12468
12474
|
async function mergeThread() {
|
|
12469
12475
|
const data = await apiAdapter.getThread(threadRef.current);
|
|
12470
12476
|
const server = data && data.messages || [];
|
|
12477
|
+
const turn = liveTurn.current;
|
|
12478
|
+
const ownIds = /* @__PURE__ */ new Set();
|
|
12479
|
+
let progress;
|
|
12480
|
+
if (turn) {
|
|
12481
|
+
for (const m of server) {
|
|
12482
|
+
if (turn.known.has(m.id)) continue;
|
|
12483
|
+
ownIds.add(m.id);
|
|
12484
|
+
if (m.role === "assistant") progress = m;
|
|
12485
|
+
}
|
|
12486
|
+
}
|
|
12471
12487
|
const ids = new Set(server.map((m) => m.id));
|
|
12472
12488
|
serverCount.current = server.length;
|
|
12473
|
-
|
|
12489
|
+
serverIds.current = ids;
|
|
12490
|
+
const next = [...server.filter((m) => !ownIds.has(m.id)), ...listRef.current.filter((m) => !ids.has(m.id))];
|
|
12491
|
+
commit(turn && progress ? next.map((m) => m.id === turn.holderId ? foldProgress(m, progress) : m) : next);
|
|
12492
|
+
}
|
|
12493
|
+
function foldProgress(holder, progress) {
|
|
12494
|
+
return Object.assign({}, holder, {
|
|
12495
|
+
steps: progress.steps ?? holder.steps,
|
|
12496
|
+
text: progress.text || holder.text,
|
|
12497
|
+
packet: progress.packet ?? holder.packet
|
|
12498
|
+
});
|
|
12474
12499
|
}
|
|
12475
12500
|
React70.useEffect(() => {
|
|
12476
12501
|
if (!apiAdapter) {
|
|
@@ -12625,6 +12650,7 @@ function useChatEngine(opts) {
|
|
|
12625
12650
|
{ id: userId, role: "user", text: turn.text || null, attachments: turn.attachments, pending: true, timestamp: (/* @__PURE__ */ new Date()).toISOString() },
|
|
12626
12651
|
{ id: holderId, role: "assistant", text: "", streaming: !!apiAdapter.streamMessage, working: !apiAdapter.streamMessage, timestamp: (/* @__PURE__ */ new Date()).toISOString() }
|
|
12627
12652
|
);
|
|
12653
|
+
liveTurn.current = { known: new Set(serverIds.current), holderId };
|
|
12628
12654
|
const ac = typeof AbortController !== "undefined" ? new AbortController() : { abort() {
|
|
12629
12655
|
}, signal: void 0 };
|
|
12630
12656
|
abortRef.current = ac;
|
|
@@ -12680,6 +12706,7 @@ function useChatEngine(opts) {
|
|
|
12680
12706
|
commit(listRef.current.filter((m) => m.id !== holderId));
|
|
12681
12707
|
}
|
|
12682
12708
|
} finally {
|
|
12709
|
+
liveTurn.current = null;
|
|
12683
12710
|
abortRef.current = null;
|
|
12684
12711
|
busyRef.current = false;
|
|
12685
12712
|
setBusy(false);
|