mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
fix(coach): stop offering a view chip the result panel already toggles
A table the answer displays with a chart renders its own chart/table toggle, and the "Show as a chart" / "Show as a table" chips under it repeated that control. The server no longer derives a view chip for such a table; a table the answer only used, folded under "Data used", still gets "Show as a chart", since that brings it into the answer. A reuse turn shows its table with the toggle and so offers no view chip either. The rule is one predicate in a leaf module, applied where chips are derived and where a stored reply is read back, so a reply stored before the change offers the same chips as a new one on every client.
This commit is contained in:
1 parent
0c3de5bdfb
commit
b0ac267af9
8 files changed
+158
-63
No files matched your search
@@ -212,17 +212,17 @@ describe("a reuse chip", () => {
|
||||
messageId: h.LAST_ASSISTANT_ID,
|
||||
ref: "r1",
|
||||
});
|
||||
const [chips] = framesOf<{ followUps: CoachFollowUp[] }>(
|
||||
run.frames,
|
||||
"followUps",
|
||||
);
|
||||
expect(chips.followUps.map((c) => c.kind)).toEqual(["as_chart"]);
|
||||
// The result renders with its own chart/table toggle, so no chip
|
||||
// offers the chart again.
|
||||
expect(
|
||||
framesOf<{ followUps: CoachFollowUp[] }>(run.frames, "followUps"),
|
||||
).toEqual([]);
|
||||
expect(m.appendMessage).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ role: "assistant", providerType: "reuse" }),
|
||||
);
|
||||
});
|
||||
|
||||
it("answers 'as a chart' with the stored chart and offers the table view", async () => {
|
||||
it("answers 'as a chart' with the stored chart and leaves the table to its toggle", async () => {
|
||||
conversationWithChips();
|
||||
const run = await tap("f3");
|
||||
expect(providerCalls).toHaveLength(0);
|
||||
@@ -231,11 +231,9 @@ describe("a reuse chip", () => {
|
||||
"result",
|
||||
).map((f) => f.result);
|
||||
expect(result.chart).toEqual(world.storedTables[0].chart);
|
||||
const [chips] = framesOf<{ followUps: CoachFollowUp[] }>(
|
||||
run.frames,
|
||||
"followUps",
|
||||
);
|
||||
expect(chips.followUps.map((c) => c.kind)).toEqual(["as_table"]);
|
||||
expect(
|
||||
framesOf<{ followUps: CoachFollowUp[] }>(run.frames, "followUps"),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("still passes the rate limit", async () => {
|
||||
|
||||
Reference in new issue
Block a user