@syntrologie/adapt-chatbot 2.57.0 → 2.58.0
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/AdaptiveChatBar.d.ts +6 -0
- package/dist/AdaptiveChatBar.d.ts.map +1 -1
- package/dist/AdaptiveChatBar.js +3 -3
- package/dist/AdaptiveChatBarMountable.d.ts.map +1 -1
- package/dist/AdaptiveChatTrail.js +2 -2
- package/dist/AdaptiveChipsStrip.d.ts +6 -6
- package/dist/ChatAssistantLit.js +2 -2
- package/dist/{chunk-AIQMQZBV.js → chunk-HD2NXGYO.js} +3 -3
- package/dist/{chunk-AIQMQZBV.js.map → chunk-HD2NXGYO.js.map} +1 -1
- package/dist/{chunk-XPUHW2YO.js → chunk-T6VEDUXD.js} +13 -6
- package/dist/chunk-T6VEDUXD.js.map +7 -0
- package/dist/{chunk-LFJ54PIF.js → chunk-UFTSEIQP.js} +2 -2
- package/dist/{chunk-GN7Z5IVP.js → chunk-YFZCMLV6.js} +5 -5
- package/dist/chunk-YFZCMLV6.js.map +7 -0
- package/dist/runtime.js +38 -4
- package/dist/runtime.js.map +3 -3
- package/dist/schema.d.ts +56 -20
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +3 -0
- package/dist/schema.js.map +2 -2
- package/package.json +1 -1
- package/dist/chunk-GN7Z5IVP.js.map +0 -7
- package/dist/chunk-XPUHW2YO.js.map +0 -7
- /package/dist/{chunk-LFJ54PIF.js.map → chunk-UFTSEIQP.js.map} +0 -0
package/dist/runtime.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
decodeMutationEnvelope,
|
|
6
6
|
fetchMountedElements,
|
|
7
7
|
renderFallbackHtml
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-HD2NXGYO.js";
|
|
9
9
|
import {
|
|
10
10
|
ElementInstanceStore,
|
|
11
11
|
TileHandler,
|
|
@@ -14,13 +14,13 @@ import {
|
|
|
14
14
|
} from "./chunk-VIRIVP7H.js";
|
|
15
15
|
import {
|
|
16
16
|
pickPersona
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-T6VEDUXD.js";
|
|
18
18
|
import {
|
|
19
19
|
getElementInstanceStore,
|
|
20
20
|
setElementInstanceStore
|
|
21
21
|
} from "./chunk-EWPPVPJ4.js";
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-UFTSEIQP.js";
|
|
23
|
+
import "./chunk-YFZCMLV6.js";
|
|
24
24
|
import "./chunk-HV52LYST.js";
|
|
25
25
|
import {
|
|
26
26
|
DIVE_DEEPER_EVENT,
|
|
@@ -3152,6 +3152,14 @@ function getState(container) {
|
|
|
3152
3152
|
function setState(container, state) {
|
|
3153
3153
|
container[STATE_KEY] = state;
|
|
3154
3154
|
}
|
|
3155
|
+
function transcriptMessages(transcript) {
|
|
3156
|
+
return transcript.map((m, i) => ({
|
|
3157
|
+
id: `transcript-${i}`,
|
|
3158
|
+
role: m.role,
|
|
3159
|
+
text: m.text,
|
|
3160
|
+
status: "complete"
|
|
3161
|
+
}));
|
|
3162
|
+
}
|
|
3155
3163
|
function applyPlaceholder(bar, cfg2) {
|
|
3156
3164
|
if (cfg2.placeholder !== void 0) bar.placeholder = cfg2.placeholder;
|
|
3157
3165
|
if (cfg2.assistantName !== void 0) bar.assistantName = cfg2.assistantName;
|
|
@@ -3331,6 +3339,19 @@ function wireListeners(bar, state) {
|
|
|
3331
3339
|
var AdaptiveChatBarMountable = {
|
|
3332
3340
|
mount(container, mountConfig) {
|
|
3333
3341
|
const cfg2 = mountConfig ?? {};
|
|
3342
|
+
if (cfg2.transcript?.length) {
|
|
3343
|
+
const bar2 = document.createElement("adaptive-chat-bar");
|
|
3344
|
+
applyPlaceholder(bar2, cfg2);
|
|
3345
|
+
bar2.readOnly = true;
|
|
3346
|
+
bar2.messages = transcriptMessages(cfg2.transcript);
|
|
3347
|
+
container.appendChild(bar2);
|
|
3348
|
+
const cleanup = () => {
|
|
3349
|
+
bar2.remove();
|
|
3350
|
+
setState(container, null);
|
|
3351
|
+
};
|
|
3352
|
+
setState(container, { bar: bar2, cleanup, cfg: cfg2 });
|
|
3353
|
+
return cleanup;
|
|
3354
|
+
}
|
|
3334
3355
|
configureTransportIfPossible(cfg2);
|
|
3335
3356
|
const bridge = bootSupportChat(cfg2.supportChat);
|
|
3336
3357
|
if (bridge && !isSupportChatInboxWired()) {
|
|
@@ -3402,6 +3423,19 @@ var AdaptiveChatBarMountable = {
|
|
|
3402
3423
|
const state = getState(container);
|
|
3403
3424
|
if (!state) return;
|
|
3404
3425
|
const cfg2 = mountConfig ?? {};
|
|
3426
|
+
const wasTranscript = Boolean(state.cfg.transcript?.length);
|
|
3427
|
+
const isTranscript = Boolean(cfg2.transcript?.length);
|
|
3428
|
+
if (wasTranscript !== isTranscript) {
|
|
3429
|
+
throw new Error(
|
|
3430
|
+
"adaptive-chatbot:chat-bar cannot switch between a read-only transcript and a live chat in update(); unmount and mount again."
|
|
3431
|
+
);
|
|
3432
|
+
}
|
|
3433
|
+
if (isTranscript && cfg2.transcript) {
|
|
3434
|
+
applyPlaceholder(state.bar, cfg2);
|
|
3435
|
+
state.bar.messages = transcriptMessages(cfg2.transcript);
|
|
3436
|
+
state.cfg = cfg2;
|
|
3437
|
+
return;
|
|
3438
|
+
}
|
|
3405
3439
|
configureTransportIfPossible(cfg2);
|
|
3406
3440
|
applyPlaceholder(state.bar, cfg2);
|
|
3407
3441
|
state.cfg = cfg2;
|