feat: 新增了周期性交易列表、账户卡片、分类选择器等多个核心组件和页面,并引入了AI服务。

This commit is contained in:
2026-01-28 15:41:16 +08:00
parent c7f1571a73
commit 71472e00b6
24 changed files with 1129 additions and 1109 deletions

View File

@@ -237,15 +237,30 @@ function Home() {
const { greeting, insight } = getDailyBriefing();
// Phase 3: Financial Health Score (Mock Logic)
// In a real app, this would be complex. Here we use a simple placeholder derived from net worth/assets ratio
// Phase 3: Financial Health Score (Enhanced Logic)
const calculateHealthScore = () => {
if (totalAssets === 0) return 60; // Baseline
const ratio = (totalAssets - totalLiabilities) / totalAssets;
let score = Math.round(ratio * 100);
if (score < 40) score = 40;
if (score > 98) score = 98;
return score;
// 1. Solvency Score (70% weight): Net Worth / Total Assets
// If no assets, assume baseline 60 if no debt, else lower
if (totalAssets === 0) return totalLiabilities > 0 ? 40 : 60;
const solvencyRatio = (totalAssets - totalLiabilities) / totalAssets; // 1.0 = perfect, 0.0 = bankrupt
// 2. Streak Bonus (10% weight): Encourages habit
const streakBonus = (streakInfo?.currentStreak || 0) > 3 ? 5 : 0;
// 3. Activity Bonus (20% weight): Scored if todaySpend > 0 or yesterdaySpend > 0 (active user)
const activityBonus = (todaySpend > 0 || yesterdaySpend > 0) ? 5 : 0;
// Weights: Base (might be high) -> normalized
// Strategy: Map 0-1 solvency to 40-90 range, then add bonuses
// Solvency 1.0 -> 90
// Solvency 0.5 -> 65
// Solvency 0.0 -> 40
let finalScore = 40 + (solvencyRatio * 50);
finalScore += streakBonus + activityBonus;
return Math.min(Math.max(Math.round(finalScore), 40), 99);
};
const healthScore = calculateHealthScore();