@firstlovecenter/ai-chat 0.6.0 → 0.6.1
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 +7 -0
- package/dist/ui/index.cjs +11 -6
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.js +11 -6
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -468,17 +468,22 @@ function sanitiseBlock(input) {
|
|
|
468
468
|
}
|
|
469
469
|
return { kind: "callout", tone: input.tone, text: input.text };
|
|
470
470
|
}
|
|
471
|
+
function isBlankString(v) {
|
|
472
|
+
return typeof v !== "string" || !v.trim();
|
|
473
|
+
}
|
|
471
474
|
function isBlockEmpty(b) {
|
|
472
475
|
if (b.kind === "paragraph_brief") {
|
|
473
|
-
if (b.prose && b.prose.trim()) return false;
|
|
474
|
-
|
|
476
|
+
if (typeof b.prose === "string" && b.prose.trim()) return false;
|
|
477
|
+
const facts = Array.isArray(b.key_facts) ? b.key_facts : [];
|
|
478
|
+
return facts.length === 0 || facts.every(isBlankString);
|
|
475
479
|
}
|
|
476
480
|
if (b.kind === "list") {
|
|
477
|
-
|
|
481
|
+
const items = Array.isArray(b.items) ? b.items : [];
|
|
482
|
+
return items.length === 0 || items.every(isBlankString);
|
|
478
483
|
}
|
|
479
|
-
if (b.kind === "callout") return
|
|
480
|
-
if (b.kind === "chart") return b.data.length === 0;
|
|
481
|
-
if (b.kind === "table") return b.rows.length === 0;
|
|
484
|
+
if (b.kind === "callout") return isBlankString(b.text);
|
|
485
|
+
if (b.kind === "chart") return !Array.isArray(b.data) || b.data.length === 0;
|
|
486
|
+
if (b.kind === "table") return !Array.isArray(b.rows) || b.rows.length === 0;
|
|
482
487
|
return false;
|
|
483
488
|
}
|
|
484
489
|
function AnswerBlocks({ blocks }) {
|