Files
beige/plans/核销-第12环-归档.md
yangqianqian ff21116ff8 A8: 文案按A/B/C三套正交叙事生成,避免套路化重复
- constants: 新增 TEXT_NARRATIVE_BY_STRATEGY(A痛点/B场景/C成分),与图片侧同轴
- build_prompt: 加 strategy_narrative 参数并注入 prompt
- text_variants: 全链路透传(含优化轮)
- run_text_generation: 改循环三套,text_count均摊(divmod余前补),跨套去重,打_strategy标记
- TextCandidate: 加 strategy String(4) 字段 + 迁移021(已upgrade head)
- packaging: 打包按strategy精准配对文图(texts_by_strategy映射+三层兜底)
- SSE text_candidate 事件携带 strategy

独立agent交叉验证7改造点全过,边界(text_count<3/无别名/不截断)无must-fix

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 10:00:47 +08:00

40 lines
6.0 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 核销表 · 第12环 归档
> 90分级验收孙总方法论·硬门禁。已吸收独立交叉验证修正。auto=机器判定human=目视。
## 模块目标
①history 按日期/品类筛选(现平铺) ②approved 下载交付包 zip 结构完整 ③多套打包(1-3套各独立笔记夹) ④客户输入物(产品/标杆)可导出(数据归属红线)。
## Ralph 修改步骤
| # | 改什么 | 落点 |
|---|--------|------|
| S1 | list_tasks 加 date_from/date_to/product_id query paramfromisoformat 转换invalid 返回 40001 | tasks.py:137-149 |
| S2 | _fmt_task 加 product_name(调用方传入)list_tasks 一次性 `Product.id.in_([...])` 建 id→name dict 避免N+1顶部补 `from app.models.product import Product`(当前无此import) | tasks.py:58-64 |
| S3 | history/page.tsx 加 dateFrom/dateTo state + 两个 `<input type=date>`(提 DateRangeFilter 子组件防超100行) | history/page.tsx:28-44 + JSX 50-94 |
| S4 | HistoryTable 表头/行加"产品"列(显 product_name ?? '-') | history/components.tsx:70-127 |
| S5 | TaskListItem 加 `product_name?:string` | dto.tasks.ts:8-16 |
| S6 | ✅多套打包(2026-06-18实做修正分组依据):实测真相=图按 `ImageCandidate.strategy`(A/B/C三套正交叙事)分组,三套图均以first_copy第1条文案为语境生成→**按strategy分组比angle_label更贴数据实际,且无需加set_index列**。改 packaging_task.py:查全部图按strategy分组(OrderedDict)+同(strategy,seq)取最新id去重(防重生重复)+老数据strategy=None归"_"单套兼容;文案配对:选中文案数≥套数则一套一条否则共用第1条;每套成独立note进exporter | packaging_task.py:45-100 |
| S7 | 新建 GET /products/export + /benchmarks/export(format=json/csv)require_write_permissionbenchmarks/export 需 Product JOIN 填 product_name(复用 _fmt_benchmark 不够,只有 product_id) | products.py + benchmarks.py |
| S8 | 配置页产品 tab + 历史归档页各加"导出数据"按钮,通用 ExportButton(url,filename) 调 getBlob 下载 | history/components.tsx 或 config/ExportTab.tsx |
## 验收清单(做完一个勾一个)
- [x] **A1**auto日期筛选✅2026-06-18 ws3实测:全量79条→当日(2026-06-17)区间过滤=4条,未来(2099+)=0条;非法日期"not-a-date"→raise_param_error返400/40001(非500)。date_to含当日(+1天开区间)。
- [x] **A2**autoproduct_id 筛选✅2026-06-18 ws3实测:product_id=1过滤命中78条,product_name批量查到'素颜霜'(防N+1:set收集→一次in_查询建name_map)。
- [ ] **A3**human前端产品列/history 表头有"产品"列,每行显产品名(非数字),与 GET /products/{id}.name 一致。【代码已就绪:components.tsx加产品列+dto加product_name,typecheck过+独立审核过;待Z阶段浏览器目视】
- [ ] **A4**human日期控件有开始/结束 date input填后表格刷新XHR URL 含 date_from/date_to结果≤全量。【代码已就绪:HistoryFilters.tsx日期input+产品下拉+清除,page接入筛选变化重置页码;待Z阶段浏览器目视】
- [ ] **A5**human下载交付包approved 任务点"下载交付包"≤60s 触发下载 delivery-{id}.zip(>1KB)`unzip -l` 含 note_01/文案.txt/发布清单/合规说明。
- [x] **A6**autozip 结构完整✅2026-06-18 task74端到端验:zip解出note_01/02/03各7项(6图+文案.txt),发布清单+合规说明在root,18张图全非空真写入(磁盘文件真读到)。
- [x] **A7**auto文案.txt 格式✅2026-06-18 task74验:note_02/文案.txt以"【标题】懒人三分钟搞定,倍分子上脸气色回来了"开头(非{,JSON已解析),品牌词"倍分子"已植入。
- [x] **A8**human+auto多套打包+三套不同角度文案✅2026-06-18 task74(6图×3套A/B/C)端到端真跑:选1条文案→建package→build_delivery_package→`grep note_0[1-3]`=3套各6图,每套独立note_0N夹+文案.txt。✅2026-06-18 补全"三套各配不同角度文案"(倩倩姐拍板"方向对按这个写"):①constants加TEXT_NARRATIVE_BY_STRATEGY(A痛点/B场景/C成分,与图侧同轴)②build_prompt加strategy_narrative参数并注入prompt③text_variants全链路透传(含优化轮)④run_text_generation改循环A/B/C三套,text_count三套均摊(divmod余前补),跨套previous_copies去重,每条打_strategy⑤TextCandidate加strategy String(4)+迁移021(已upgrade head,SHOW COLUMNS确认)⑥打包按strategy精准配对(texts_by_strategy映射+三层兜底)⑦SSE带strategy。worker已restart重载。独立agent二次交叉验证7改造点全✅+边界(text_count<3跳n=0/无别名/count每套不截断)全过,结论"可进一条龙无must-fix"。品牌词"倍分子"植入文案+图片文字层(不P瓶身)。
- [x] **A9**auto产品 JSON 导出✅2026-06-18 ws3实测:export_products返3条,selling_points类型=list(['烟酰胺改善暗沉提亮','水解珍珠锁水匀肤']非JSON字符串);端点真注册路由表+顺序在/products/{product_id}之前(idx9<13不被吞)。
- [ ] **A10**auto标杆 CSV 导出:⏸️逻辑已审(CSV带UTF-8 BOM+JOIN Product填product_name+json/csv双格式),但ws3无标杆数据未触发真导出;待录标杆后验或Z阶段一条龙带验。
- [ ] **A11**auto导出权限审计注——require_write_permission 当前只查 workspace_members 不分角色(workspace_guard.py:65-88);未登录调 → code=40101workspace 成员 → 200。【两端点均挂require_write_permission,独立审核确认】
- [ ] **A12**human不显 token 余额(红线):⚠️审计改 human(curl 拿不到Next.js水合后DOM)——浏览器 Ctrl+F 搜"余额/用量/tokens/balance"无结果。【HistoryFilters/page/components均无余额字段,独立审核确认】
## 待北哥定义(不阻断代码)
- 多套打包图片套间对应ImageCandidate 无 set_index是否加列关联文案还是退化"图共享复制进每套夹"(本期默认退化)。
- 导出入口位置(产品管理 tab 按钮 / 历史归档页全局)。
- CSV 是否加 UTF-8 BOM(Windows Excel 不乱码)。