feat: 拆解单文件 Demo 为 Vite + React 前端工程

- 保留根目录 index.html 作为 v1 单文件原型(不参与构建)
- app/ 下新建 Vite + React 工程(vite.config root 指向 app/,两版互不干扰)
- 状态收敛到 useAppStore(表单/消息/串行确认/一键发品 + 4 条异步编排流)
- 生成卡片重构为结构化数据驱动渲染,按钮为真实 React 事件
- 6 大表单模块卡片化;Agent 意图解析与偏好学习抽为独立 lib
- 功能与视觉与 v1 完全一致,浏览器端全流程回归通过
This commit is contained in:
2026-09-16 13:37:58 +08:00
parent 609e0afb29
commit 01dcd83987
29 changed files with 3872 additions and 19 deletions
+36
View File
@@ -0,0 +1,36 @@
/* ============================================================
* 「越用越好用」偏好学习
* ocStore 持久化到 localStorage:发品次数、沉淀的偏好、最近一次配置。
* ============================================================ */
const OC_KEY = 'fliggy_oc'
export function loadOC() {
try {
return JSON.parse(localStorage.getItem(OC_KEY) || 'null') || { count: 0, prefs: [], last: null }
} catch {
return { count: 0, prefs: [], last: null }
}
}
export function saveOC(store) {
try { localStorage.setItem(OC_KEY, JSON.stringify(store)) } catch { /* 演示环境忽略 */ }
}
/** 成长等级:Lv.1 通用模板 → Lv.2 风格匹配 → Lv.3 爆款复刻 */
export function ocLevelInfo(store) {
if (store.count >= 10) return { name: 'Lv.3 爆款复刻', next: '已解锁:自动复用您的历史爆款结构与定价', pct: 100 }
if (store.count >= 3) return { name: 'Lv.2 风格匹配', next: `再用 ${10 - store.count} 次解锁「Lv.3 爆款复刻」`, pct: (store.count / 10) * 100 }
return { name: 'Lv.1 通用模板', next: `再用 ${3 - store.count} 次解锁「Lv.2 风格匹配」(生成将贴合您的风格)`, pct: (store.count / 10) * 100 }
}
/** 每次发品沉淀的偏好条目 */
export function buildPrefs(destShort, days, type, theme) {
return [
`${destShort}路线偏好:${days}${type}`,
`「${theme}」人群文案风格`,
'纯玩无购物话术偏好',
'平季低于市场 5% 定价策略',
'首月立减冲榜促销习惯'
]
}