Appearance
💳 项目案例|个人财务 Agent:记账、分类、预算提醒
📌 财务 Agent = 自然语言记账 + 自动分类 + 预算预警。核心价值不是"替你记账"——是"让你知道钱花在哪了,花超了吗"。
MVP
用户发"午餐 35 元" → Agent 分类(餐饮) → 存入数据库 → 月度报告 + 预算提醒
技术架构
Telegram Bot → Agent(NLP提取金额+分类) → SQLite → 月度统计 → 推送报告
核心代码
python
def record_expense(user_msg: str):
parsed = llm.extract(user_msg, schema={"amount": float, "category": str, "note": str})
db.insert("expenses", parsed)
total = db.query("SELECT SUM(amount) FROM expenses WHERE month=?", [this_month])
if total > budget:
return f"⚠️ 本月已花 {total},超出预算 {budget}!"常见坑
- LLM 提取金额不准("花了差不多 50 块"→提取为 50)→ 加验证:如果金额不在 1-100000 范围内,要求用户确认
- 分类不一致("午餐"有时是"餐饮"有时是"外食")→ 用固定分类表 + LLM 匹配
🍋 本文为 AI Agent 学习路线 · 项目案例库。© 2026 AI小柠檬。