@firstlovecenter/ai-chat 0.2.2 → 0.2.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/ui/index.cjs CHANGED
@@ -402,8 +402,22 @@ function sanitiseBlock(input) {
402
402
  }
403
403
  return { kind: "callout", tone: input.tone, text: input.text };
404
404
  }
405
+ function isBlockEmpty(b) {
406
+ if (b.kind === "paragraph_brief") {
407
+ if (b.prose && b.prose.trim()) return false;
408
+ return b.key_facts.length === 0 || b.key_facts.every((f) => !f.trim());
409
+ }
410
+ if (b.kind === "list") {
411
+ return b.items.length === 0 || b.items.every((i) => !i.trim());
412
+ }
413
+ if (b.kind === "callout") return !b.text.trim();
414
+ if (b.kind === "chart") return b.data.length === 0;
415
+ if (b.kind === "table") return b.rows.length === 0;
416
+ return false;
417
+ }
405
418
  function AnswerBlocks({ blocks }) {
406
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3", children: blocks.map((b, i) => /* @__PURE__ */ jsxRuntime.jsx(BlockView, { block: b }, i)) });
419
+ const visible = blocks.filter((b) => !isBlockEmpty(b));
420
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3", children: visible.map((b, i) => /* @__PURE__ */ jsxRuntime.jsx(BlockView, { block: b }, i)) });
407
421
  }
408
422
  function BlockView({ block }) {
409
423
  if (block.kind === "paragraph_brief") {
@@ -1112,7 +1126,7 @@ function AnswerView({
1112
1126
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center text-sm text-muted-foreground", children: [
1113
1127
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-1 inline size-3.5 animate-spin" }),
1114
1128
  "Thinking\u2026",
1115
- liveElapsed != null && liveElapsed >= 1e3 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-1 tabular-nums", children: [
1129
+ liveElapsed != null && liveElapsed >= 1e3 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-xs tabular-nums", children: [
1116
1130
  "(",
1117
1131
  formatDuration(liveElapsed),
1118
1132
  ")"