Commit Graph

18 Commits

Author SHA1 Message Date
25c6f2a3b7 阶段 3 剩余:编辑与版本化
功能	文件	说明
幻灯片显隐	routes.py, PptResult.vue, ppt-api.ts	每页可点击隐藏/恢复,隐藏页在缩略图中半透明显示,页码标注隐藏数量
DeckContract 快照	renderer.py, celery_tasks.py, ppt_session.py	生成时保存完整 deck JSON 到文件系统,供版本化回溯
版本化生成	celery_tasks.py, task_service.py, routes.py	POST /preview/:id/regenerate → 递增版本号 → 用 deck 重新渲染 → 追加到版本历史,不覆盖旧版
版本历史 UI	PptResult.vue	右栏显示版本列表(版本号/页数/时间),当前版本高亮标记
数据库迁移	migrate_025.py	新增 deck_contract_path、versions_json 字段
阶段 4:UI 重构
功能	文件	说明
保险绿主题	PptPage.vue, PptGenerate.vue, PptResult.vue, PptSlideCanvas.vue	主色从 #2563eb 蓝改为 #3B7A57 保险绿,背景暖灰 #f0f7f3
生成决策展示	PptGenerate.vue	新增"系统决策"区域,展示检测场景、选用模板、计划书数量、险种类型、保司
骨架屏加载	PptResult.vue	preview_status=none/generating 时显示骨架屏 + 加载动画,不再显示静态 fallback
新增后端接口(本轮)
方法	路径	功能
POST	/ppt/preview/:id/regenerate	基于编辑内容生成新版本
PUT	/ppt/preview/:id/slide/:index	增加 hidden 字段支持
新增 Celery 任务
任务名	说明
insurance.regenerate_ppt	读取 DeckContract → 应用编辑 → 重新渲染 → 保存新版本
2026-07-29 21:41:28 +08:00
f23b08eec6 07-29 PPT生成优化第一阶段完成:
已完成约 40%(阶段 1 + 阶段 2 + 阶段 3 基础编辑),覆盖了计划书中最核心的 P0 需求:

 真实预览(Canvas 方案替代了 LibreOffice 方案)
 质量检查(6 自动 + 4 人工)
 三栏结果工作台
 基础文字编辑
2026-07-29 21:26:48 +08:00
fa67b83bbf 核心改进:
小册子解析:上传后3秒内返回,解析通过 Celery 异步执行,状态流转 pending → queued → parsing → parsed/failed,失败保留错误原因,启动时自动恢复卡住任务
保司Logo:支持多张图片上传、设主图、删除、排序,主图自动同步到 logo_url 保持向后兼容
文件存储:统一使用 get_storage_root() 持久化目录,Docker 重启不丢文件
2026-07-28 20:35:28 +08:00
c7df34d0cd 07-27 阶段 状态 进度
阶段 1:数据库与工作区	 完成	100%
阶段 2:Celery 后台任务	 完成	100%
阶段 3:前端刷新恢复与多工作区	 完成	100%
阶段 4:任务坞与任务中心	 完成	100%
阶段 5:版本化编辑	 完成	100%
阶段 6:测试与灰度	 未开始	0%
2026-07-28 17:53:14 +08:00
8192f6a783 07-27 PDF提取优化 2026-07-28 16:45:14 +08:00
0b69978812 回复提交 2026-07-27 15:40:58 +08:00
e3479f0546 上线阻断问题全部修复
#	问题	修复	文件
1	前端构建失败(引号错误)	size="small type=" → size="small" type="	PosterHistoryPage.vue
2	migrate_014 ORM vs 缺失列	全部改为原始 SQL,不再引用 ORM 模型	migrate_014.py
3	cleanup 字段名错误	output_path → ppt_path	cleanup.py
4	文案生成 case 越权	添加 case.user_id != user_id 校验	poster/service.py
5	存储路径未接通持久化卷	全部改用 get_storage_root()(默认 /app/api/storage/insurance)	config.py, ppt/routes.py, poster/service.py, poster/tasks.py
高风险问题修复
#	问题	修复	文件
6	migrate_019 rollback 撤销成功字段	每个 ALTER 后立即 commit,失败只回滚当前语句	migrate_019.py
7	迁移锁 Windows 不兼容 + 句柄未持久化	全局变量保存锁句柄,支持 Windows msvcrt	api/insurance/db/__init__.py
8	PDF 校验异常时放行	异常返回 False(文件损坏)	security.py
9	健康检查始终返回成功	缺少关键资源时返回 503 + missing 列表	poster/routes.py
10	短密钥掩码泄露原值	≤4 字符返回 ****	ppt_admin_service.py
11	设置无键名白名单	添加 _ALLOWED_SETTING_KEYS 白名单	ppt_admin_service.py
12	容器重启任务永久 stuck	添加 recover_stale_tasks() 启动恢复函数	poster/tasks.py, ppt/parse_worker.py
2026-07-27 13:52:09 +08:00
67b2dac23f slidesConfig 结构错误 — migrate_017 输出改为数组格式,migrate_019 修复历史数据
迁移系统加固 — 加 advisory lock 防并发,失败回滚并中止启动(原来是 catch-and-continue)
安全漏洞 — Settings/History API 权限收紧,API key 返回掩码值,海报 case 所有权校验
依赖缺失 — requirements.txt 补齐 python-pptx/openai/Pillow,Dockerfile 改为统一安装
海报鉴权下载 — 前端全部改用 authenticated blob,不再 window.open 无 token URL
LLM 配置分离 — 海报文案读取 poster_llm_*(不再复用 ppt_llm_*),支持 config namespace
图片生成器 — 兼容 b64_json 和 URL 两种响应格式,追踪 generation_mode/provider/model
种子数据 — 新环境自动获得 2 个海报模板 + 2 个文案模板
2026-07-27 13:21:34 +08:00
961924b299 0727 PPT加海报功能01版本修复-修复一个版本 2026-07-27 10:36:13 +08:00
8e897276e7 fix: rename upgrade() to migrate() in migrate_017 so it runs automatically
The migration runner (db/__init__.py) calls module.migrate() with no
arguments, but migrate_017 defined upgrade(engine). This meant the
slides_config_json column was never added to insurance_ppt_templates
in production, causing a 500 on /insurance/ppt/render-options.
2026-07-25 08:47:35 +08:00
1debd7df39 feat(ppt): upgrade renderer from 5 fixed slides to 10+ configurable pages
Rewrite fast_pptx_renderer.py to read requiredPageTypes from template
config instead of hardcoding 5 slides. Add 10 slide builder functions
(cover, company, narrative, chart, timeline, table, compare, synergy,
conclusion, closing) with python-pptx native charts.

Key changes:
- Renderer reads templateConfig.requiredPageTypes and slidesConfig
  from DeckContract to determine slide sequence and per-slide metadata
- routes.py loads PptTemplate and PptCompany from DB, normalizes all
  PDF extractions (not just the first), passes full context to renderer
- renderer.py injects templateConfig, company info, and multi-product
  data into DeckContract
- Add slides_config_json column to PptTemplate (migrate_017) for
  per-slide title/narrative/chartType configuration via admin UI
- Admin template editor now supports drag-reorder slides, per-slide
  title/narrative hint, chart/table type selection
- Add requiredPageTypes to savings/ink, savings/minimal, savings/business
  templates (were missing, causing fallback to defaults)
- Fix IUL normalizer: add payYears and totalPremium to policy dict
- Fix CI/IUL normalizer: add totalSurrenderValue alias to benefitRows
  so charts render correctly for all product types
- Port calculation functions from baodanppt: decade_rows, paid_premium,
  simple_return, compound_return, find_payback_year

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 17:49:09 +08:00
623815a134 fix: 添加 PyMuPDF 详细错误信息并创建缺失的迁移文件
- extraction.py: 添加更详细的 ImportError 错误信息,显示具体原因
- migrate_016.py: 创建 insurance_ppt_sessions 表(修复 500 错误)

解决 PDF 上传失败问题:
1. PyMuPDF 导入失败时显示具体错误原因
2. 数据库表 insurance_ppt_sessions 不存在导致插入失败

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 11:29:49 +08:00
effc2a24e4 0723 PPT加海报功能01版本修复 2026-07-23 17:40:12 +08:00
5d28e4518e 0723 PPT加海报功能初步完成 2026-07-23 15:04:16 +08:00
4a556a1cc7 0723 PPT功能初步融合 2026-07-23 13:10:50 +08:00
c32efbaed9 0723 代码整理 2026-07-23 08:52:59 +08:00
d0a887d5c2 0712 修复一个版本 2026-07-12 14:17:18 +08:00
bc4c339e0c 第一次提交。可以使用企微群消息 2026-07-02 23:13:23 +08:00