@smartspace/chat-ui 1.13.1-pr.414.ffc49fe → 1.13.1-pr.418.0119b54
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.d.ts +7 -4
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -439,10 +439,13 @@ declare function mapMessageDtoToModel(dto: MessageDto): Message;
|
|
|
439
439
|
declare function mapMessagesDtoToModels(dto: MessageDto[]): Message[];
|
|
440
440
|
/**
|
|
441
441
|
* Merge a streaming delta into a message. `outputs` is a cumulative snapshot
|
|
442
|
-
* keyed by
|
|
443
|
-
*
|
|
444
|
-
*
|
|
445
|
-
*
|
|
442
|
+
* keyed by value `id` — when an output streams from "He" → "Hel" → "Hello" we
|
|
443
|
+
* receive three deltas each carrying the full text-so-far under one id, so we
|
|
444
|
+
* replace by id rather than appending. Several blocks can be wired into a
|
|
445
|
+
* single flow output (five render blocks feeding one "Files" output, say);
|
|
446
|
+
* those arrive under the same NAME but different ids and must all survive,
|
|
447
|
+
* which is why the key is not `(name, type)`. Errors aren't documented as
|
|
448
|
+
* cumulative, so we append them.
|
|
446
449
|
*/
|
|
447
450
|
declare function applyDeltaToMessage(target: Message, delta: {
|
|
448
451
|
outputs: MessageValue[];
|
package/dist/index.js
CHANGED
|
@@ -19683,7 +19683,7 @@ var MessageItem = ({
|
|
|
19683
19683
|
const slotByKey = /* @__PURE__ */ new Map();
|
|
19684
19684
|
const values = [];
|
|
19685
19685
|
for (const v of sortedValues) {
|
|
19686
|
-
const key =
|
|
19686
|
+
const key = v.id ? `id|${v.id}` : `nametype|${v.name}|${v.type}`;
|
|
19687
19687
|
const existing = slotByKey.get(key);
|
|
19688
19688
|
if (existing !== void 0) {
|
|
19689
19689
|
values[existing] = v;
|
|
@@ -20173,7 +20173,11 @@ function applyDeltaToMessage(target, delta) {
|
|
|
20173
20173
|
const nextValues = (target.values ?? []).slice();
|
|
20174
20174
|
for (const incoming of delta.outputs) {
|
|
20175
20175
|
const idx = nextValues.findIndex(
|
|
20176
|
-
(v) =>
|
|
20176
|
+
(v) => (
|
|
20177
|
+
// Values with no id come from a server that predates per-output ids;
|
|
20178
|
+
// fall back to the old key so their chunks still replace in place.
|
|
20179
|
+
incoming.id ? v.id === incoming.id : v.name === incoming.name && v.type === incoming.type
|
|
20180
|
+
)
|
|
20177
20181
|
);
|
|
20178
20182
|
if (idx === -1) nextValues.push(incoming);
|
|
20179
20183
|
else nextValues[idx] = incoming;
|