mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
perf(insights): send snapshots as compact JSON and size the cap against it
The status cards, the briefing, the derived assessments and the Coach snapshot drop the two-space indentation from the JSON they hand the model. The content is unchanged (the hash gate hashes the object, so stored hashes stay valid). MAX_SNAPSHOT_CHARS is now measured on the compact string: 14 000 for the status cards and the Coach, which every snapshot that fitted the old 24 000 pretty-printed characters still fits, so the model reads the same data for fewer tokens. Refs #1217
This commit is contained in:
1 parent
ae8b614dd0
commit
c2245d1d79
19 files changed
+226
-235
No files matched your search
@@ -671,7 +671,9 @@ export const POST = apiHandler((request: NextRequest) =>
|
||||
const compactFeatures = compactSections(
|
||||
features as unknown as Record<string, unknown>,
|
||||
);
|
||||
const featuresJson = JSON.stringify(compactFeatures, null, 2);
|
||||
// Compact on the wire: indentation is about 40% of a pretty-printed
|
||||
// payload, and the model reads the structure without it (#1217).
|
||||
const featuresJson = JSON.stringify(compactFeatures);
|
||||
if (payloadDowngraded) {
|
||||
annotate({
|
||||
meta: {
|
||||
|
||||
Reference in new issue
Block a user