@smartspace/chat-ui 1.13.1-pr.393.e0707fc → 1.13.1-pr.394.e869835

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.js CHANGED
@@ -20104,7 +20104,14 @@ function pushContent(items, value) {
20104
20104
  return;
20105
20105
  }
20106
20106
  if (Array.isArray(value)) {
20107
- items.push(...value);
20107
+ const looksLikeContent = value.every(
20108
+ (it) => it != null && typeof it === "object" && ("text" in it || "image" in it)
20109
+ );
20110
+ if (looksLikeContent) {
20111
+ items.push(...value);
20112
+ } else {
20113
+ items.push({ text: "```json\n" + JSON.stringify(value, null, 2) + "\n```" });
20114
+ }
20108
20115
  return;
20109
20116
  }
20110
20117
  if (typeof value === "object") {
@@ -20179,28 +20186,25 @@ var MessageItem = ({
20179
20186
  let groupOpen = false;
20180
20187
  let keyCounter = 0;
20181
20188
  let lastStatusNode = null;
20182
- const groupHasAnything = () => groupContent.length > 0 || groupFiles.length > 0 || groupSources.length > 0;
20183
20189
  const flush = (nextType) => {
20184
- if (groupHasAnything()) {
20185
- bubbles.push(
20186
- /* @__PURE__ */ jsx(
20187
- MessageBubble,
20188
- {
20189
- createdBy: lastCreatedBy,
20190
- createdByUserId: lastCreatedByUserId,
20191
- createdAt: lastCreatedAt,
20192
- type: groupType,
20193
- content: groupContent,
20194
- files: groupFiles,
20195
- sources: groupSources,
20196
- chatbotName,
20197
- userOutput: null,
20198
- userInput: null
20199
- },
20200
- `bubble-${message.id ?? "msg"}-${keyCounter++}`
20201
- )
20202
- );
20203
- }
20190
+ bubbles.push(
20191
+ /* @__PURE__ */ jsx(
20192
+ MessageBubble,
20193
+ {
20194
+ createdBy: lastCreatedBy,
20195
+ createdByUserId: lastCreatedByUserId,
20196
+ createdAt: lastCreatedAt,
20197
+ type: groupType,
20198
+ content: groupContent,
20199
+ files: groupFiles,
20200
+ sources: groupSources,
20201
+ chatbotName,
20202
+ userOutput: null,
20203
+ userInput: null
20204
+ },
20205
+ `bubble-${message.id ?? "msg"}-${keyCounter++}`
20206
+ )
20207
+ );
20204
20208
  groupContent = [];
20205
20209
  groupFiles = [];
20206
20210
  groupSources = [];
@@ -20232,9 +20236,6 @@ var MessageItem = ({
20232
20236
  case "prompt":
20233
20237
  case "response":
20234
20238
  case "content": {
20235
- if (v.value === "") {
20236
- continue;
20237
- }
20238
20239
  lastStatusNode = null;
20239
20240
  if (groupContent.length > 0) flush(v.type);
20240
20241
  if (v.value == null) {
@@ -20289,7 +20290,7 @@ var MessageItem = ({
20289
20290
  }
20290
20291
  case "sources": {
20291
20292
  groupSources = coerceSources(v.value);
20292
- if (groupSources.length > 0) groupOpen = true;
20293
+ groupOpen = true;
20293
20294
  break;
20294
20295
  }
20295
20296
  default: {
@@ -20303,7 +20304,7 @@ var MessageItem = ({
20303
20304
  lastCreatedBy = v.createdBy;
20304
20305
  lastCreatedByUserId = v.createdByUserId;
20305
20306
  }
20306
- if (groupOpen && groupHasAnything()) {
20307
+ if (groupOpen) {
20307
20308
  bubbles.push(
20308
20309
  /* @__PURE__ */ jsx(
20309
20310
  MessageBubble,