Improve monthly insights: structured prompt, bullet recommendations, visual cards
- Strengthen prompt with required observations (savings rate, spend-to-income, top category, anomaly), dollar-formatted amounts, and pay schedule context - Preserve recommendation array structure; store as JSON array string in DB - Render recommendations as numbered cards with icons in home dashboard - Add spend-vs-income progress bar and category flow mini bar chart - Fix test assertions for new JSON array recommendation format Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ vi.mock("@/lib/db", () => {
|
||||
db: {
|
||||
expense: { findMany: vi.fn() },
|
||||
paycheck: { findMany: vi.fn() },
|
||||
paySchedule: { findFirst: vi.fn().mockResolvedValue(null) },
|
||||
monthlyInsight,
|
||||
},
|
||||
};
|
||||
@@ -86,7 +87,7 @@ describe("generateMonthlyInsight", () => {
|
||||
|
||||
expect(result.source).toBe("model");
|
||||
expect(result.insight.summary).toBe("Spending is stable.");
|
||||
expect(result.insight.recommendations).toBe("Keep food spending under watch.");
|
||||
expect(result.insight.recommendations).toBe('["Keep food spending under watch."]');
|
||||
});
|
||||
|
||||
it("coerces array recommendations from the local model", async () => {
|
||||
|
||||
Reference in New Issue
Block a user