api-config.json 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. {
  2. "name": "user-persona",
  3. "displayName": "用户画像生成",
  4. "description": "融合电商VOC和社媒VOC,AI生成核心用户画像、使用场景和决策因素",
  5. "category": "synthesis",
  6. "version": "1.3.0",
  7. "type": "analysis",
  8. "parameters": {
  9. "reviewKeywordCloud": {
  10. "type": "object",
  11. "required": true,
  12. "description": "review-keyword-cloud 输出"
  13. },
  14. "reviewPainPoints": {
  15. "type": "object",
  16. "required": true,
  17. "description": "review-pain-point-extraction 输出"
  18. },
  19. "reviewHighlights": {
  20. "type": "object",
  21. "required": true,
  22. "description": "review-highlight-extraction 输出"
  23. },
  24. "socialTrendAnalysis": {
  25. "type": "object",
  26. "required": false,
  27. "description": "social-trend-analysis 输出(可选)"
  28. },
  29. "categoryKeyword": {
  30. "type": "string",
  31. "required": true,
  32. "description": "品类关键词"
  33. }
  34. },
  35. "pipeline": [
  36. {
  37. "step": 1,
  38. "name": "提取使用场景",
  39. "type": "compute",
  40. "logic": "extractScenarios(reviewKeywordCloud, socialTrendAnalysis)",
  41. "algorithm": {
  42. "keywordClustering": "从评论关键词中提取场景相关词(bedroom/bathroom/gift/office等)",
  43. "socialScenarios": "从社媒趋势中提取热门场景(home decor/self-care/gifting等)",
  44. "frequencyRank": "按场景出现频率排序",
  45. "implementation": "将关键词按场景词典(bedroom/bathroom/gift/office/travel等)匹配分类,统计频率排序"
  46. },
  47. "output": "scenarios"
  48. },
  49. {
  50. "step": 2,
  51. "name": "提取决策因素",
  52. "type": "compute",
  53. "logic": "extractDecisionFactors(reviewPainPoints, reviewHighlights, socialTrendAnalysis)",
  54. "algorithm": {
  55. "fromPainPoints": "痛点反转 = 用户核心关注点(e.g. “香味太淡”→“香味浓度”)",
  56. "fromHighlights": "亮点直接映射为决策因素",
  57. "weight": "factor.weight = painFreq*0.4 + highlightFreq*0.3 + socialMention*0.3",
  58. "implementation": "痛点topic反转为决策因素 + 亮点topic直接映射 + 社媒热词补充,用weight公式排序"
  59. },
  60. "output": "decisionFactors"
  61. },
  62. {
  63. "step": 3,
  64. "name": "AI生成用户画像",
  65. "type": "ai",
  66. "logic": "generatePersonas(scenarios, decisionFactors, reviewKeywordCloud, socialTrendAnalysis)",
  67. "aiConfig": {
  68. "systemPrompt": "你是跨境电商用户研究专家。只输出一个合法JSON对象。禁止输出Markdown、代码围栏、解释文字。",
  69. "userPromptTemplate": "基于以下VOC数据,生成3-5个核心用户画像。每个画像包含: 名称/年龄段/核心场景/决策因素/价格敏感度/社媒平台偏好/购买动机。\n场景数据: ${scenarios}\n决策因素: ${decisionFactors}\n关键词: ${topKeywords}",
  70. "outputFormat": "{\"personas\":[{\"name\":\"“品质生活家\u201d\",\"ageRange\":\"28-40\",\"coreScenario\":\"家居装饰\",\"decisionFactors\":[\"品质\",\"香味\"],\"priceSensitivity\":\"medium\",\"socialPreference\":\"Instagram\",\"motivation\":\"提升家居氛围\"}]}",
  71. "temperature": 0.3,
  72. "maxTokens": 3000,
  73. "promptPattern": "system约束JSON输出 + user提供结构化数据 + outputFormat示例引导格式"
  74. },
  75. "output": "personas"
  76. },
  77. {
  78. "step": 4,
  79. "name": "购买行为分析",
  80. "type": "compute",
  81. "logic": "analyzePurchaseBehavior(personas, reviewKeywordCloud, reviewPainPoints, socialTrendAnalysis)",
  82. "algorithm": {
  83. "priceSensitivityMapping": {
  84. "method": "将用户画像的价格敏感度映射到品类价格带",
  85. "high": "偏好低价带/中低价带,重视促销折扣",
  86. "medium": "偏好黄金中价带,重视性价比",
  87. "low": "偏好中高/高价带,重视品质与品牌"
  88. },
  89. "seasonalPatterns": {
  90. "method": "从评论日期分布+社媒趋势提取季节性购买规律",
  91. "peakMonths": "评论集中的月份 = 购买高峰期",
  92. "giftSeason": "Q4(感恩节/圣诞)/情人节/母亲节等送礼场景高峰"
  93. },
  94. "channelPreference": {
  95. "method": "根据社媒平台偏好+年龄段推断购买渠道",
  96. "youngAdult": "TikTok种草→Amazon购买, 重视网红推荐",
  97. "middleAge": "搜索驱动→Amazon直购, 重视评论和评分",
  98. "giftBuyer": "社媒灵感→直接购买, 重视包装和送达时间"
  99. }
  100. },
  101. "output": "purchaseBehavior"
  102. },
  103. {
  104. "step": 5,
  105. "name": "生成画像手册",
  106. "type": "compute",
  107. "logic": "buildHandbook(personas, scenarios, decisionFactors, purchaseBehavior)",
  108. "algorithm": {
  109. "format": "Markdown格式: 每个画像一个章节,包含基本信息/场景/决策因素/购买行为/营销建议",
  110. "scenarioChart": "场景分布饼图数据",
  111. "factorRanking": "决策因素权重柱状图数据",
  112. "marketingStrategy": "每个画像的精准营销策略: 触达渠道/内容形式/促销引导/复购策略"
  113. },
  114. "output": "handbook"
  115. }
  116. ],
  117. "response": {
  118. "type": "object",
  119. "properties": {
  120. "personas": {
  121. "type": "array",
  122. "description": "核心用户类型列表",
  123. "items": {
  124. "type": "object",
  125. "properties": {
  126. "name": { "type": "string" },
  127. "ageRange": { "type": "string" },
  128. "coreScenario": { "type": "string" },
  129. "decisionFactors": { "type": "array", "items": { "type": "string" } },
  130. "priceSensitivity": { "type": "string", "enum": ["high", "medium", "low"] },
  131. "socialPreference": { "type": "string" },
  132. "motivation": { "type": "string" },
  133. "proportion": { "type": "number", "description": "估算占比%" }
  134. }
  135. }
  136. },
  137. "scenarioDistribution": {
  138. "type": "array",
  139. "description": "使用场景分布",
  140. "items": {
  141. "type": "object",
  142. "properties": {
  143. "scenario": { "type": "string" },
  144. "proportion": { "type": "number" }
  145. }
  146. }
  147. },
  148. "decisionFactorRanking": {
  149. "type": "array",
  150. "description": "决策因素权重排序",
  151. "items": {
  152. "type": "object",
  153. "properties": {
  154. "factor": { "type": "string" },
  155. "weight": { "type": "number" }
  156. }
  157. }
  158. },
  159. "handbookMarkdown": { "type": "string", "description": "画像手册(Markdown)" },
  160. "purchaseBehavior": {
  161. "type": "object",
  162. "description": "购买行为分析",
  163. "properties": {
  164. "priceSensitivityMap": {
  165. "type": "array",
  166. "items": {
  167. "type": "object",
  168. "properties": {
  169. "persona": { "type": "string" },
  170. "sensitivity": { "type": "string", "enum": ["high", "medium", "low"] },
  171. "preferredBand": { "type": "string" },
  172. "promotionResponse": { "type": "string" }
  173. }
  174. }
  175. },
  176. "seasonalPatterns": {
  177. "type": "array",
  178. "items": {
  179. "type": "object",
  180. "properties": {
  181. "period": { "type": "string" },
  182. "peakLevel": { "type": "string", "enum": ["high", "medium", "low"] },
  183. "dominantPersona": { "type": "string" },
  184. "marketingFocus": { "type": "string" }
  185. }
  186. }
  187. },
  188. "channelPreferences": {
  189. "type": "array",
  190. "items": {
  191. "type": "object",
  192. "properties": {
  193. "persona": { "type": "string" },
  194. "primaryChannel": { "type": "string" },
  195. "discoveryPath": { "type": "string" },
  196. "conversionDriver": { "type": "string" }
  197. }
  198. }
  199. }
  200. }
  201. }
  202. }
  203. },
  204. "timeout": 300000,
  205. "retry": {
  206. "maxAttempts": 2,
  207. "delay": 1000,
  208. "backoffMultiplier": 2
  209. },
  210. "tokenConfig": {
  211. "type": "bearer",
  212. "configFile": "~/.openclaw/voc-credentials.json",
  213. "tokenField": "vocToken",
  214. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  215. "resolutionOrder": ["configFile", "currentToken"],
  216. "onMissing": {
  217. "action": "showPaymentQR",
  218. "qrCodeUrl": "https://payment.brainhack.cn/apig-pay.html?authid=T0iOotHcDX",
  219. "paymentCheckEndpoint": "https://server.fmode.cn/api/apig/getApig",
  220. "pollingIntervalMs": 3000,
  221. "pollingTimeoutMs": 300000,
  222. "onPaymentSuccess": "retrySkillWithNewToken",
  223. "title": "扫码开通 VOC-AI 数据服务",
  224. "message": "请扫描下方二维码完成支付,支付成功后将自动获取 Token 并继续执行。"
  225. },
  226. "onBalanceInsufficient": {
  227. "action": "showPaymentQR",
  228. "qrCodeUrl": "https://payment.brainhack.cn/apig-pay.html?authid=T0iOotHcDX",
  229. "paymentCheckEndpoint": "https://server.fmode.cn/api/apig/getApig",
  230. "pollingIntervalMs": 3000,
  231. "pollingTimeoutMs": 300000,
  232. "onPaymentSuccess": "retrySkillWithNewToken",
  233. "title": "VOC-AI Token 余额不足,请扫码充值",
  234. "message": "当前 Token 余额不足,请扫描二维码充值,支付完成后将自动继续执行。"
  235. }
  236. },
  237. "errorHandling": {
  238. "balanceInsufficient": {
  239. "conditions": [
  240. { "responseField": "code", "operator": "in", "value": [-2, -3, -10, 402, 429] },
  241. { "responseField": "msg", "operator": "contains", "value": ["余额不足", "insufficient", "balance", "quota"] },
  242. { "responseField": "message", "operator": "contains", "value": ["余额不足", "insufficient", "balance"] }
  243. ],
  244. "matchMode": "any",
  245. "trigger": "tokenConfig.onBalanceInsufficient"
  246. },
  247. "unauthorized": {
  248. "conditions": [
  249. { "responseField": "code", "operator": "in", "value": [401, 403] },
  250. { "responseField": "msg", "operator": "contains", "value": ["unauthorized", "token", "invalid", "auth"] }
  251. ],
  252. "matchMode": "any",
  253. "trigger": "tokenConfig.onMissing"
  254. }
  255. }
  256. }