@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/CHANGELOG.md +13 -0
- package/dist/server/index.cjs +38 -0
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +38 -0
- package/dist/server/index.js.map +1 -1
- package/dist/ui/index.cjs +16 -2
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +16 -2
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -381,8 +381,22 @@ function sanitiseBlock(input) {
|
|
|
381
381
|
}
|
|
382
382
|
return { kind: "callout", tone: input.tone, text: input.text };
|
|
383
383
|
}
|
|
384
|
+
function isBlockEmpty(b) {
|
|
385
|
+
if (b.kind === "paragraph_brief") {
|
|
386
|
+
if (b.prose && b.prose.trim()) return false;
|
|
387
|
+
return b.key_facts.length === 0 || b.key_facts.every((f) => !f.trim());
|
|
388
|
+
}
|
|
389
|
+
if (b.kind === "list") {
|
|
390
|
+
return b.items.length === 0 || b.items.every((i) => !i.trim());
|
|
391
|
+
}
|
|
392
|
+
if (b.kind === "callout") return !b.text.trim();
|
|
393
|
+
if (b.kind === "chart") return b.data.length === 0;
|
|
394
|
+
if (b.kind === "table") return b.rows.length === 0;
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
384
397
|
function AnswerBlocks({ blocks }) {
|
|
385
|
-
|
|
398
|
+
const visible = blocks.filter((b) => !isBlockEmpty(b));
|
|
399
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: visible.map((b, i) => /* @__PURE__ */ jsx(BlockView, { block: b }, i)) });
|
|
386
400
|
}
|
|
387
401
|
function BlockView({ block }) {
|
|
388
402
|
if (block.kind === "paragraph_brief") {
|
|
@@ -1091,7 +1105,7 @@ function AnswerView({
|
|
|
1091
1105
|
/* @__PURE__ */ jsxs("p", { className: "flex items-center text-sm text-muted-foreground", children: [
|
|
1092
1106
|
/* @__PURE__ */ jsx(Loader2, { className: "mr-1 inline size-3.5 animate-spin" }),
|
|
1093
1107
|
"Thinking\u2026",
|
|
1094
|
-
liveElapsed != null && liveElapsed >= 1e3 && /* @__PURE__ */ jsxs("span", { className: "ml-
|
|
1108
|
+
liveElapsed != null && liveElapsed >= 1e3 && /* @__PURE__ */ jsxs("span", { className: "ml-2 text-xs tabular-nums", children: [
|
|
1095
1109
|
"(",
|
|
1096
1110
|
formatDuration(liveElapsed),
|
|
1097
1111
|
")"
|