feat: AI 摘要持久化 — DB 缓存 + 自动加载

后端:
- 新增 ai_summaries 表 (week_start/week_end/generated_by/summary)
- get_cached_summary(): 按周+用户查缓存
- delete_cached_summary(): 生成前清理旧缓存
- generate_summary(): 自动保存到 DB
- API: GET /ai/summary(加载) POST(生成) DELETE(清除)

前端:
- onMounted 自动 GET 缓存摘要, 有则直接展示
- 按钮: 无缓存→'AI 生成摘要', 有缓存→'重新生成'
- 标题栏显示生成时间戳
This commit is contained in:
2026-06-25 11:45:04 +08:00
parent e681beba24
commit 5b38246801
6 changed files with 175 additions and 19 deletions
+3
View File
@@ -1,6 +1,9 @@
import api from './index'
export const aiApi = {
getSummary(params?: { reference_date?: string; period?: string }) {
return api.get('/ai/summary', { params })
},
generateSummary(params?: { reference_date?: string; period?: string }) {
return api.post('/ai/summary', null, { params })
},