@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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to `@firstlovecenter/ai-chat` are documented here.
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.6.1] — 2026-05-08
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **`isBlockEmpty()` crash on malformed historical rows** — `AnswerBlocks`'s render-time filter called `f.trim()` on every entry of `key_facts` / `items`, which threw `Cannot read properties of undefined (reading 'trim')` when a stored chat had a `null` or non-string entry in either array. Stored chats from truncated reasoning-model responses (pre-0.6.0, before `max_output_tokens` was admin-configurable) commonly contained such entries. The new `isBlockEmpty` treats null / undefined / non-string entries as blank via a small `isBlankString()` helper, and guards `.length === 0` checks behind `Array.isArray(...)` so a row missing the array entirely also no-ops cleanly. Auto-resuming an older session now renders without throwing.
|
|
13
|
+
|
|
8
14
|
## [0.6.0] — 2026-05-08
|
|
9
15
|
|
|
10
16
|
Admin-configurable runtime knobs and chat continuity. Two new fields on `ai_settings` give admins control over the token budget and the assistant's persona without a redeploy, and both chat UIs now auto-resume the most recent session on return.
|
|
@@ -146,6 +152,7 @@ Initial public release on npm under `@firstlovecenter/ai-chat`.
|
|
|
146
152
|
- Dual ESM + CJS output via `tsup` with full `.d.ts` (and `.d.cts`) generation.
|
|
147
153
|
- UI bundle gets a post-build `'use client';` directive injection (tsup otherwise strips module-level directives during bundling, breaking RSC consumers that import the UI from a server file).
|
|
148
154
|
|
|
155
|
+
[0.6.1]: https://github.com/firstlovecenter/flc-ai-chat/compare/v0.6.0...v0.6.1
|
|
149
156
|
[0.6.0]: https://github.com/firstlovecenter/flc-ai-chat/compare/v0.5.0...v0.6.0
|
|
150
157
|
[0.5.0]: https://github.com/firstlovecenter/flc-ai-chat/compare/v0.2.3...v0.5.0
|
|
151
158
|
[0.2.3]: https://github.com/firstlovecenter/flc-ai-chat/compare/v0.2.2...v0.2.3
|
package/dist/ui/index.cjs
CHANGED
|
@@ -489,17 +489,22 @@ function sanitiseBlock(input) {
|
|
|
489
489
|
}
|
|
490
490
|
return { kind: "callout", tone: input.tone, text: input.text };
|
|
491
491
|
}
|
|
492
|
+
function isBlankString(v) {
|
|
493
|
+
return typeof v !== "string" || !v.trim();
|
|
494
|
+
}
|
|
492
495
|
function isBlockEmpty(b) {
|
|
493
496
|
if (b.kind === "paragraph_brief") {
|
|
494
|
-
if (b.prose && b.prose.trim()) return false;
|
|
495
|
-
|
|
497
|
+
if (typeof b.prose === "string" && b.prose.trim()) return false;
|
|
498
|
+
const facts = Array.isArray(b.key_facts) ? b.key_facts : [];
|
|
499
|
+
return facts.length === 0 || facts.every(isBlankString);
|
|
496
500
|
}
|
|
497
501
|
if (b.kind === "list") {
|
|
498
|
-
|
|
502
|
+
const items = Array.isArray(b.items) ? b.items : [];
|
|
503
|
+
return items.length === 0 || items.every(isBlankString);
|
|
499
504
|
}
|
|
500
|
-
if (b.kind === "callout") return
|
|
501
|
-
if (b.kind === "chart") return b.data.length === 0;
|
|
502
|
-
if (b.kind === "table") return b.rows.length === 0;
|
|
505
|
+
if (b.kind === "callout") return isBlankString(b.text);
|
|
506
|
+
if (b.kind === "chart") return !Array.isArray(b.data) || b.data.length === 0;
|
|
507
|
+
if (b.kind === "table") return !Array.isArray(b.rows) || b.rows.length === 0;
|
|
503
508
|
return false;
|
|
504
509
|
}
|
|
505
510
|
function AnswerBlocks({ blocks }) {
|