mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
Merge AI client + coach cache fixes into release/v1.20.0
Send the OpenAI JSON response format only when JSON is requested and no tools are in play, so the Coach prose path (and the tool loop's final round) is no longer corrupted into a JSON blob. Resolve the Anthropic finish reason to tool_calls whenever tool_use blocks are present. Memoize the per-request feature extraction and prefs read and project the feature query, so the coach tool fan-out shares one read instead of six.
This commit is contained in:
commit
d3b341f8a7
12 files changed
+279
-43
No files matched your search
@@ -681,6 +681,18 @@ export async function extractFeatures(
|
||||
? { userId, measuredAt: { gte: sinceCutoff }, deletedAt: null }
|
||||
: { userId, deletedAt: null },
|
||||
orderBy: { measuredAt: "asc" },
|
||||
// Project only the columns every downstream consumer reads (`byType`,
|
||||
// `summarize`, BP pairing, and `reconstructSleepNights`'s `SleepStageRow`).
|
||||
// The PULSE / glucose windows are 200k-row-class; pulling every column
|
||||
// (notes, externalId, …) is pure wasted I/O on the shared Prisma pool.
|
||||
select: {
|
||||
type: true,
|
||||
value: true,
|
||||
measuredAt: true,
|
||||
sleepStage: true,
|
||||
source: true,
|
||||
deviceType: true,
|
||||
},
|
||||
});
|
||||
|
||||
// v1.18.11 P1 — when the bulk read is bounded to a recent window, the
|
||||
|
||||
Reference in new issue
Block a user