@helpai/elements 0.9.0 → 0.9.2
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/elements-web-component.esm.js +27 -27
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +27 -27
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +27 -27
- package/elements.esm.js.map +3 -3
- package/elements.js +27 -27
- package/elements.js.map +3 -3
- package/index.mjs +17 -4
- package/package.json +1 -1
- package/web-component.mjs +17 -4
package/index.mjs
CHANGED
|
@@ -3454,7 +3454,7 @@ function MessageBubble({ message, strings, responseMode, showReasoning, showTool
|
|
|
3454
3454
|
const streaming = message.role === "assistant" && message.status === "streaming";
|
|
3455
3455
|
const bufferedHold = responseMode === "buffered" && streaming;
|
|
3456
3456
|
const working = streaming && !hasAnswerText.value;
|
|
3457
|
-
const
|
|
3457
|
+
const showStreamDots = streaming && !bufferedHold && !(reasoningVisible.value && working);
|
|
3458
3458
|
return /* @__PURE__ */ jsx10("div", { class: `${p9}-bubble-row`, "data-role": message.role, "data-testid": tid(TID.messageBubble, message.id), children: /* @__PURE__ */ jsxs7("div", { class: `${p9}-bubble`, children: [
|
|
3459
3459
|
bufferedHold ? /* @__PURE__ */ jsx10(LoadingSpinner, { label: strings.loading }) : partList.map((part) => /* @__PURE__ */ jsx10(
|
|
3460
3460
|
PartView,
|
|
@@ -3467,7 +3467,7 @@ function MessageBubble({ message, strings, responseMode, showReasoning, showTool
|
|
|
3467
3467
|
},
|
|
3468
3468
|
partKey(part)
|
|
3469
3469
|
)),
|
|
3470
|
-
|
|
3470
|
+
showStreamDots && /* @__PURE__ */ jsx10(TypingDots, {}),
|
|
3471
3471
|
message.status === "error" && message.errorText ? /* @__PURE__ */ jsx10("div", { class: `${p9}-error`, role: "alert", children: /* @__PURE__ */ jsx10("span", { children: message.errorText }) }) : null
|
|
3472
3472
|
] }) });
|
|
3473
3473
|
}
|
|
@@ -5290,6 +5290,8 @@ function App({ options, hostElement, bus }) {
|
|
|
5290
5290
|
homeNavRef.current = createHomeNav(landingTab(), ids, (tab) => persistence.saveActiveModule(tab));
|
|
5291
5291
|
}
|
|
5292
5292
|
const homeNav = homeNavRef.current;
|
|
5293
|
+
const chatTabIdRef = useRef8(void 0);
|
|
5294
|
+
chatTabIdRef.current = chatTabId();
|
|
5293
5295
|
const [sessionReady, setSessionReady] = useState11(false);
|
|
5294
5296
|
const isInlineLike = options.mode === "standalone" || options.mode === "inline";
|
|
5295
5297
|
const initialPanelRef = useRef8(
|
|
@@ -5381,9 +5383,16 @@ function App({ options, hostElement, bus }) {
|
|
|
5381
5383
|
setPanelSize(state.panelSize);
|
|
5382
5384
|
}, [sessionReady, options, persistence]);
|
|
5383
5385
|
const homeNavSeeded = useRef8(false);
|
|
5386
|
+
const resumeActiveRef = useRef8(false);
|
|
5387
|
+
const resumeBubbleRef = useRef8(null);
|
|
5384
5388
|
useEffect17(() => {
|
|
5385
5389
|
if (!sessionReady || homeNavSeeded.current) return;
|
|
5386
5390
|
homeNavSeeded.current = true;
|
|
5391
|
+
if (resumeActiveRef.current) {
|
|
5392
|
+
const chatTab = chatTabIdRef.current;
|
|
5393
|
+
if (chatTab) homeNav.switchTab(chatTab);
|
|
5394
|
+
return;
|
|
5395
|
+
}
|
|
5387
5396
|
homeNav.reset(landingTab());
|
|
5388
5397
|
}, [sessionReady]);
|
|
5389
5398
|
const playWelcome = useCallback8(
|
|
@@ -5469,7 +5478,8 @@ function App({ options, hostElement, bus }) {
|
|
|
5469
5478
|
const chat = res.messages?.length ? { sessionId: persistedChatId, canContinue: res.canContinue ?? true, messages: res.messages } : await transport.loadSession(persistedChatId);
|
|
5470
5479
|
if (isStale()) return;
|
|
5471
5480
|
const loaded = (chat.messages ?? []).map(fromWireMessage);
|
|
5472
|
-
|
|
5481
|
+
const tail = resumeBubbleRef.current ? [resumeBubbleRef.current] : [];
|
|
5482
|
+
if (loaded.length || tail.length) messagesSig.value = [...loaded, ...tail];
|
|
5473
5483
|
setCanSend(chat.canContinue ?? true);
|
|
5474
5484
|
setSuggestions(chat.suggestions ?? []);
|
|
5475
5485
|
} catch (err) {
|
|
@@ -5504,11 +5514,13 @@ function App({ options, hostElement, bus }) {
|
|
|
5504
5514
|
for await (const evt of handle.iter) {
|
|
5505
5515
|
if (!bubble) {
|
|
5506
5516
|
bubble = makeAssistantMessage();
|
|
5517
|
+
resumeBubbleRef.current = bubble;
|
|
5507
5518
|
reducer.attach(bubble);
|
|
5508
5519
|
messagesSig.value = [...messagesSig.value, bubble];
|
|
5509
5520
|
setStreaming(true);
|
|
5510
5521
|
setActiveCancel(() => handle.cancel);
|
|
5511
|
-
|
|
5522
|
+
resumeActiveRef.current = true;
|
|
5523
|
+
const chatTab = chatTabIdRef.current;
|
|
5512
5524
|
if (chatTab) homeNav.switchTab(chatTab);
|
|
5513
5525
|
log16.info("resumed in-flight reply on mount");
|
|
5514
5526
|
}
|
|
@@ -5528,6 +5540,7 @@ function App({ options, hostElement, bus }) {
|
|
|
5528
5540
|
}
|
|
5529
5541
|
log16.debug("mount resume ended without completing", { err });
|
|
5530
5542
|
} finally {
|
|
5543
|
+
resumeBubbleRef.current = null;
|
|
5531
5544
|
if (bubble) {
|
|
5532
5545
|
reducer.detach();
|
|
5533
5546
|
setStreaming(false);
|
package/package.json
CHANGED
package/web-component.mjs
CHANGED
|
@@ -3518,7 +3518,7 @@ function MessageBubble({ message, strings, responseMode, showReasoning, showTool
|
|
|
3518
3518
|
const streaming = message.role === "assistant" && message.status === "streaming";
|
|
3519
3519
|
const bufferedHold = responseMode === "buffered" && streaming;
|
|
3520
3520
|
const working = streaming && !hasAnswerText.value;
|
|
3521
|
-
const
|
|
3521
|
+
const showStreamDots = streaming && !bufferedHold && !(reasoningVisible.value && working);
|
|
3522
3522
|
return /* @__PURE__ */ jsx10("div", { class: `${p9}-bubble-row`, "data-role": message.role, "data-testid": tid(TID.messageBubble, message.id), children: /* @__PURE__ */ jsxs7("div", { class: `${p9}-bubble`, children: [
|
|
3523
3523
|
bufferedHold ? /* @__PURE__ */ jsx10(LoadingSpinner, { label: strings.loading }) : partList.map((part) => /* @__PURE__ */ jsx10(
|
|
3524
3524
|
PartView,
|
|
@@ -3531,7 +3531,7 @@ function MessageBubble({ message, strings, responseMode, showReasoning, showTool
|
|
|
3531
3531
|
},
|
|
3532
3532
|
partKey(part)
|
|
3533
3533
|
)),
|
|
3534
|
-
|
|
3534
|
+
showStreamDots && /* @__PURE__ */ jsx10(TypingDots, {}),
|
|
3535
3535
|
message.status === "error" && message.errorText ? /* @__PURE__ */ jsx10("div", { class: `${p9}-error`, role: "alert", children: /* @__PURE__ */ jsx10("span", { children: message.errorText }) }) : null
|
|
3536
3536
|
] }) });
|
|
3537
3537
|
}
|
|
@@ -5354,6 +5354,8 @@ function App({ options, hostElement, bus }) {
|
|
|
5354
5354
|
homeNavRef.current = createHomeNav(landingTab(), ids, (tab) => persistence.saveActiveModule(tab));
|
|
5355
5355
|
}
|
|
5356
5356
|
const homeNav = homeNavRef.current;
|
|
5357
|
+
const chatTabIdRef = useRef8(void 0);
|
|
5358
|
+
chatTabIdRef.current = chatTabId();
|
|
5357
5359
|
const [sessionReady, setSessionReady] = useState11(false);
|
|
5358
5360
|
const isInlineLike = options.mode === "standalone" || options.mode === "inline";
|
|
5359
5361
|
const initialPanelRef = useRef8(
|
|
@@ -5445,9 +5447,16 @@ function App({ options, hostElement, bus }) {
|
|
|
5445
5447
|
setPanelSize(state.panelSize);
|
|
5446
5448
|
}, [sessionReady, options, persistence]);
|
|
5447
5449
|
const homeNavSeeded = useRef8(false);
|
|
5450
|
+
const resumeActiveRef = useRef8(false);
|
|
5451
|
+
const resumeBubbleRef = useRef8(null);
|
|
5448
5452
|
useEffect17(() => {
|
|
5449
5453
|
if (!sessionReady || homeNavSeeded.current) return;
|
|
5450
5454
|
homeNavSeeded.current = true;
|
|
5455
|
+
if (resumeActiveRef.current) {
|
|
5456
|
+
const chatTab = chatTabIdRef.current;
|
|
5457
|
+
if (chatTab) homeNav.switchTab(chatTab);
|
|
5458
|
+
return;
|
|
5459
|
+
}
|
|
5451
5460
|
homeNav.reset(landingTab());
|
|
5452
5461
|
}, [sessionReady]);
|
|
5453
5462
|
const playWelcome = useCallback8(
|
|
@@ -5533,7 +5542,8 @@ function App({ options, hostElement, bus }) {
|
|
|
5533
5542
|
const chat = res.messages?.length ? { sessionId: persistedChatId, canContinue: res.canContinue ?? true, messages: res.messages } : await transport.loadSession(persistedChatId);
|
|
5534
5543
|
if (isStale()) return;
|
|
5535
5544
|
const loaded = (chat.messages ?? []).map(fromWireMessage);
|
|
5536
|
-
|
|
5545
|
+
const tail = resumeBubbleRef.current ? [resumeBubbleRef.current] : [];
|
|
5546
|
+
if (loaded.length || tail.length) messagesSig.value = [...loaded, ...tail];
|
|
5537
5547
|
setCanSend(chat.canContinue ?? true);
|
|
5538
5548
|
setSuggestions(chat.suggestions ?? []);
|
|
5539
5549
|
} catch (err) {
|
|
@@ -5568,11 +5578,13 @@ function App({ options, hostElement, bus }) {
|
|
|
5568
5578
|
for await (const evt of handle.iter) {
|
|
5569
5579
|
if (!bubble) {
|
|
5570
5580
|
bubble = makeAssistantMessage();
|
|
5581
|
+
resumeBubbleRef.current = bubble;
|
|
5571
5582
|
reducer.attach(bubble);
|
|
5572
5583
|
messagesSig.value = [...messagesSig.value, bubble];
|
|
5573
5584
|
setStreaming(true);
|
|
5574
5585
|
setActiveCancel(() => handle.cancel);
|
|
5575
|
-
|
|
5586
|
+
resumeActiveRef.current = true;
|
|
5587
|
+
const chatTab = chatTabIdRef.current;
|
|
5576
5588
|
if (chatTab) homeNav.switchTab(chatTab);
|
|
5577
5589
|
log16.info("resumed in-flight reply on mount");
|
|
5578
5590
|
}
|
|
@@ -5592,6 +5604,7 @@ function App({ options, hostElement, bus }) {
|
|
|
5592
5604
|
}
|
|
5593
5605
|
log16.debug("mount resume ended without completing", { err });
|
|
5594
5606
|
} finally {
|
|
5607
|
+
resumeBubbleRef.current = null;
|
|
5595
5608
|
if (bubble) {
|
|
5596
5609
|
reducer.detach();
|
|
5597
5610
|
setStreaming(false);
|