/* ============================================================ * 工具(Tool)定义:Agent 可调用的 8 个生成工具 * buildGen(type, ctx) 返回结构化结果: * pre —— 助手开场白(应用内静态 HTML,非用户输入) * card —— 生成卡片结构(head / lines / foot / tips),由 GenCardView 渲染 * data —— 填入表单的结构化数据 * ============================================================ */ /** 自主发品 Agent 的 8 步任务清单 */ export const agentSteps = [ { label: '商品标题', type: 'title', note: '3 方案·已选高转化款填入' }, { label: '详细介绍', type: 'intro', note: '四段式卖点已填入' }, { label: '商品详情', type: 'detail', note: '图文结构已写入编辑器' }, { label: '商品图片', type: 'image', note: '6 张配图清单已添加' }, { label: '行程编辑', type: 'itinerary', note: '逐日行程已填入' }, { label: '价格库存', type: 'price', note: '5 个团期 + 定价已填入' }, { label: 'SEO 关键词', type: 'seo', note: '6 个高流量词已提取' }, { label: '合规检查', type: 'check', note: '扫描完成·0 极限词风险' } ] /** 一键发品的 6 步流程 */ export const ocStepsDef = [ { label: '商品标题', type: 'title', note: '已选高转化方案' }, { label: '详细介绍', type: 'intro', note: '四段式卖点' }, { label: '商品详情', type: 'detail', note: '图文结构就绪' }, { label: '商品图片', type: 'image', note: '配图清单 6 张' }, { label: '行程编辑', type: 'itinerary', note: '逐日框架就绪' }, { label: '价格库存', type: 'price', note: '团期+定价就绪' } ] /** 各工具的动作名称(对话中展示用) */ export const actionLabel = { title: '生成商品标题', intro: '生成详细介绍', detail: '生成商品详情', image: '配图建议', itinerary: '规划行程', price: '价格库存方案', seo: 'SEO 关键词', check: '合规检查' } /** 图片占位调色板 */ export const imgPalette = [ { g: 'linear-gradient(135deg,#ffb300,#ff7a1a)', em: '🚤' }, { g: 'linear-gradient(135deg,#f59e0b,#ef4444)', em: '🏮' }, { g: 'linear-gradient(135deg,#8b5cf6,#ec4899)', em: '🏔️' }, { g: 'linear-gradient(135deg,#22c55e,#ffb300)', em: '🏨' }, { g: 'linear-gradient(135deg,#f97316,#facc15)', em: '🍲' }, { g: 'linear-gradient(135deg,#6366f1,#ffb300)', em: '🌅' } ] /** 表单模块 → 卡片锚点(滚动定位用) */ export const cardMap = { title: 'card-title', intro: 'card-intro', detail: 'card-detail', image: 'card-img', itinerary: 'card-itinerary', price: 'card-price' } /** 生成 8 类工具的结构化结果(ctx 为当前表单上下文) */ export function buildGen(type, ctx) { const { dest, days, type: pType, theme } = ctx const isYn = dest === '云南' switch (type) { case 'title': { const t = [ `【纯玩无购物】${dest}${days}精品${pType}·5A景区全含·${theme}首选`, `${dest}${days}深度${pType}|一价全含0自费·住${isYn ? '海景' : '景区'}酒店`, `【${theme}必选】${dest}${days}${pType}·随走随停·金牌向导·赠${isYn ? '洱海游船' : '旅拍'}体验` ] return { pre: `结合 ${dest}·${days}·${pType}·${theme} 生成 3 个高点击标题(可多次点击填入切换方案):`, card: { head: '✨ 标题方案(三选一)', lines: t.map((x, i) => `${i + 1}. ${x}`), foot: { apply: 'title', label: '⚡ 一键填入「商品标题」', regen: true }, tips: [ { cls: 'ok-pill', text: '含目的地+天数+类型,利于搜索' }, { cls: '', text: '「无购物」为平台高转化词' } ] }, data: t } } case 'intro': { const d = `【${dest}${days}${pType}·${theme}优选】全程 0 购物 0 自费,景区门票一价全含,金牌持证导游全程讲解。\n精选 ${days === '3天2晚' ? '2' : '4'} 晚高分酒店,${isYn ? '大理海景房 + 丽江古城客栈' : '近景区步行可达'},住的舒心才是真度假。\n特色体验:${isYn ? '白族扎染 + 洱海游船 + 野生菌火锅' : '深度环线,不赶路'},孩子玩得开心、大人拍得尽兴。\n服务承诺:行程透明无隐形消费,24h 专属管家,未成团提前 3 天全额退款。` return { pre: `围绕「${theme}」人群痛点,按「亮点—住宿—体验—承诺」四段式生成详细介绍:`, card: { head: '✨ 详细介绍(列表页卖点摘要)', lines: d.split('\n'), foot: { apply: 'intro', label: '⚡ 一键填入「详细介绍」', regen: true }, tips: [ { cls: 'ok-pill', text: '约 200 字,符合最佳展示长度' }, { cls: '', text: '含服务承诺,降低决策门槛' } ] }, data: d } } case 'detail': { return { pre: '已生成结构化商品详情(亮点/住宿/餐饮/保障 + 配图占位),可直接在编辑器中继续润色:', card: { head: '✨ 商品详情(图文结构)', lines: [ `行程亮点 · 0购物0自费 / 经典IP全含 / ${theme}节奏`, `住宿安排 · ${isYn ? '海景房+古城客栈' : '高分酒店'}`, `舌尖体验 · ${isYn ? '野生菌火锅+风味餐' : '特色餐 3 次'}`, `服务保障 · 金牌导游 / 24h管家 / 全额退款承诺`, `配图占位 · 行程地图 / 酒店实拍 / 餐饮实拍` ], foot: { apply: 'detail', label: '⚡ 写入「商品详情」编辑器', regen: true }, tips: [] }, data: `

🌟 行程亮点

🏨 住宿安排

🍜 舌尖体验

🛡️ 服务保障

🖼️ 此处建议插入:行程地图 / 实拍酒店 / 餐饮实拍(见「配图建议」)
` } } case 'image': { const list = [ { label: `${dest}全景主图(横版大图)`, use: '主图' }, { label: '酒店实拍·房间内饰', use: '详情' }, { label: '核心景区打卡机位', use: '详情' }, { label: '特色餐食实拍', use: '详情' }, { label: `${theme}互动瞬间抓拍`, use: '详情' }, { label: '行程地图示意', use: '详情' } ] return { pre: '根据行程内容生成 6 张配图拍摄脚本(含用途与构图建议):', card: { head: '✨ 配图清单(转化率优选顺序)', lines: list.map((im, i) => `${i + 1}. ${im.label} [${im.use}]`), foot: { apply: 'image', label: '⚡ 按清单添加到「商品图片」', regen: true }, tips: [ { cls: 'ok-pill', text: '主图含地标,点击率 +18%' }, { cls: '', text: '实拍图 > 精修图,差评更少' } ] }, data: list.map(x => ({ label: x.use === '主图' ? x.label : x.label.replace(/(.*)/, '') })) } } case 'itinerary': { const dayList = [ { title: isYn ? '抵达昆明·专车接站' : `抵达${dest}·专车接站`, desc: '落地即接,24h 接站服务,入住酒店后自由活动,推荐逛逛翠湖公园。' }, { title: isYn ? '石林风景区 → 楚雄' : '核心景区深度游', desc: '上午游览 5A 石林,午后赴楚雄,晚观彝族歌舞表演。' }, { title: isYn ? '大理古城 → 洱海游船 → 双廊' : '慢节奏主题日', desc: '上午漫步大理古城,午后洱海游船,双廊海边下午茶,看日落。' }, { title: isYn ? '丽江古城 → 玉龙雪山 → 蓝月谷' : '自由活动日', desc: '索道登玉龙雪山4506m,蓝月谷拍照,晚逛丽江四方街。' }, { title: isYn ? '束河古镇 → 返回昆明' : '自由活动·休整', desc: '睡到自然醒,逛束河古镇,午后大巴返回昆明。' }, { title: '返程日·专车送站', desc: '根据航班时间安排送站,行程圆满结束。' } ].slice(0, parseInt(days) || 6) return { pre: `按 ${days}·${pType}·${theme} 节奏规划每日行程,张弛有度:`, card: { head: '✨ 行程框架(每日含主题与安排)', lines: dayList.map((d, i) => `D${i + 1} ${d.title}`), foot: { apply: 'itinerary', label: '⚡ 填入「行程编辑」', regen: true }, tips: [ { cls: 'ok-pill', text: `每日行车 ≤ 3.5h,适合${theme}` }, { cls: '', text: 'D1/D6 只做接驳,差评率更低' } ] }, data: dayList } } case 'price': { const rows = [ { date: '2026-09-12', adult: 3299, child: 2299, stock: 18, on: true }, { date: '2026-09-26', adult: 3499, child: 2399, stock: 12, on: true }, { date: '2026-10-01', adult: 4199, child: 2899, stock: 25, on: true }, { date: '2026-10-03', adult: 4199, child: 2899, stock: 5, on: true }, { date: '2026-10-17', adult: 3399, child: 2349, stock: 20, on: true } ] return { pre: `基于近 30 天 ${dest}·${days}·${pType} 成交数据,生成 5 个团期排期与定价(含国庆档):`, card: { head: '✨ 价格库存方案', lines: [ `📊 市场区间:¥2,899-¥4,199(${theme}均价 ¥3,480)`, `🎯 平季定价:¥3,299(低于均价 5%,点击率预估 +23%)`, `📈 国庆档:¥4,199·库存充足(预计售罄率 85%)`, `💡 策略:首月立减 ¥300 冲新品榜,稳定后回调` ], foot: { apply: 'price', label: '⚡ 填入「价格库存」表', regen: true }, tips: [ { cls: 'ok-pill', text: '低于均价 5%,排序更优' }, { cls: 'warn-pill', text: '10-03 团期库存偏低,建议 +10' } ] }, data: rows } } case 'seo': { const kw = `${dest}旅游,${dest}${days},${pType},${theme}旅游,${dest}纯玩无购物,${dest}自由行攻略` const heat = [8200, 6500, 5400, 3900, 2800, 1900] return { pre: '提取 6 个高流量关键词,按搜索热度排序:', card: { head: '✨ SEO 关键词(月均搜索指数)', lines: kw.split(',').map((k, i) => `${i + 1}. ${k} 热度 ${heat[i]}`), foot: { apply: null, label: '📋 复制关键词', regen: true }, tips: [] }, data: kw } } case 'check': { return { pre: '已对 6 大模块进行 广告法 + 平台规则 双重合规扫描:', card: { head: '🛡️ 合规检查报告', lines: [ '✅ 标题:无「最」「第一」等极限词', '✅ 详细介绍:无「国家级」「顶级」违禁表述', '⚠️ 建议:「金牌导游」表述需补充资质证明材料', '⚠️ 建议:「全额退款」承诺需与退改政策页一致', 'ℹ️ 提示:主图 800×600 以上,避免文字遮挡地标' ], foot: null, tips: [ { cls: 'ok-pill', text: '极限词 0 风险' }, { cls: 'warn-pill', text: '2 项待补充' }, { cls: '', text: '审核通过率预估 96%' } ] }, data: null } } default: throw new Error('unknown tool type: ' + type) } }