api-config.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  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\":\"“品质生活家”\",\"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": {
  127. "type": "string"
  128. },
  129. "ageRange": {
  130. "type": "string"
  131. },
  132. "coreScenario": {
  133. "type": "string"
  134. },
  135. "decisionFactors": {
  136. "type": "array",
  137. "items": {
  138. "type": "string"
  139. }
  140. },
  141. "priceSensitivity": {
  142. "type": "string",
  143. "enum": [
  144. "high",
  145. "medium",
  146. "low"
  147. ]
  148. },
  149. "socialPreference": {
  150. "type": "string"
  151. },
  152. "motivation": {
  153. "type": "string"
  154. },
  155. "proportion": {
  156. "type": "number",
  157. "description": "估算占比%"
  158. }
  159. }
  160. }
  161. },
  162. "scenarioDistribution": {
  163. "type": "array",
  164. "description": "使用场景分布",
  165. "items": {
  166. "type": "object",
  167. "properties": {
  168. "scenario": {
  169. "type": "string"
  170. },
  171. "proportion": {
  172. "type": "number"
  173. }
  174. }
  175. }
  176. },
  177. "decisionFactorRanking": {
  178. "type": "array",
  179. "description": "决策因素权重排序",
  180. "items": {
  181. "type": "object",
  182. "properties": {
  183. "factor": {
  184. "type": "string"
  185. },
  186. "weight": {
  187. "type": "number"
  188. }
  189. }
  190. }
  191. },
  192. "handbookMarkdown": {
  193. "type": "string",
  194. "description": "画像手册(Markdown)"
  195. },
  196. "purchaseBehavior": {
  197. "type": "object",
  198. "description": "购买行为分析",
  199. "properties": {
  200. "priceSensitivityMap": {
  201. "type": "array",
  202. "items": {
  203. "type": "object",
  204. "properties": {
  205. "persona": {
  206. "type": "string"
  207. },
  208. "sensitivity": {
  209. "type": "string",
  210. "enum": [
  211. "high",
  212. "medium",
  213. "low"
  214. ]
  215. },
  216. "preferredBand": {
  217. "type": "string"
  218. },
  219. "promotionResponse": {
  220. "type": "string"
  221. }
  222. }
  223. }
  224. },
  225. "seasonalPatterns": {
  226. "type": "array",
  227. "items": {
  228. "type": "object",
  229. "properties": {
  230. "period": {
  231. "type": "string"
  232. },
  233. "peakLevel": {
  234. "type": "string",
  235. "enum": [
  236. "high",
  237. "medium",
  238. "low"
  239. ]
  240. },
  241. "dominantPersona": {
  242. "type": "string"
  243. },
  244. "marketingFocus": {
  245. "type": "string"
  246. }
  247. }
  248. }
  249. },
  250. "channelPreferences": {
  251. "type": "array",
  252. "items": {
  253. "type": "object",
  254. "properties": {
  255. "persona": {
  256. "type": "string"
  257. },
  258. "primaryChannel": {
  259. "type": "string"
  260. },
  261. "discoveryPath": {
  262. "type": "string"
  263. },
  264. "conversionDriver": {
  265. "type": "string"
  266. }
  267. }
  268. }
  269. }
  270. }
  271. }
  272. }
  273. },
  274. "timeout": 300000,
  275. "retry": {
  276. "maxAttempts": 2,
  277. "delay": 1000,
  278. "backoffMultiplier": 2
  279. },
  280. "tokenConfig": {
  281. "type": "bearer",
  282. "configFile": "~/.openclaw/voc-credentials.json",
  283. "tokenField": "vocToken",
  284. "resolutionOrder": [
  285. "configFile"
  286. ],
  287. "apigId": "7HwdQZk55B",
  288. "paymentUrlResolution": {
  289. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  290. "steps": [
  291. "1. 从 voc-credentials.json 获取当前 session token",
  292. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  293. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  294. "4. 将该URL展示给用户,引导扫码支付"
  295. ],
  296. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  297. "userResolveHeaders": {
  298. "X-Parse-Application-Id": "ncloudmaster",
  299. "X-Parse-Session-Token": "{vocToken}"
  300. },
  301. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  302. "paymentParams": {
  303. "user": "{resolvedUserId}",
  304. "apigid": "7HwdQZk55B",
  305. "fun_id": "HOkkX72PMF"
  306. },
  307. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  308. },
  309. "onMissing": {
  310. "action": "showPaymentQR",
  311. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  312. "title": "扫码开通 VOC-AI 数据服务",
  313. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  314. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  315. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  316. },
  317. "onBalanceInsufficient": {
  318. "action": "resolveUserThenShowPayment",
  319. "title": "VOC-AI Token 余额不足,请扫码充值",
  320. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  321. }
  322. },
  323. "errorHandling": {
  324. "balanceInsufficient": {
  325. "conditions": [
  326. {
  327. "responseField": "code",
  328. "operator": "in",
  329. "value": [
  330. -2,
  331. -3,
  332. -10,
  333. 402,
  334. 429
  335. ]
  336. },
  337. {
  338. "responseField": "msg",
  339. "operator": "contains",
  340. "value": [
  341. "余额不足",
  342. "insufficient",
  343. "balance",
  344. "quota",
  345. "没有开通",
  346. "权限或余额"
  347. ]
  348. },
  349. {
  350. "responseField": "mess",
  351. "operator": "contains",
  352. "value": [
  353. "余额不足",
  354. "insufficient",
  355. "balance",
  356. "quota",
  357. "没有开通",
  358. "权限或余额"
  359. ]
  360. },
  361. {
  362. "responseField": "message",
  363. "operator": "contains",
  364. "value": [
  365. "余额不足",
  366. "insufficient",
  367. "balance",
  368. "没有开通",
  369. "权限或余额"
  370. ]
  371. }
  372. ],
  373. "matchMode": "any",
  374. "trigger": "tokenConfig.onBalanceInsufficient"
  375. },
  376. "unauthorized": {
  377. "conditions": [
  378. {
  379. "responseField": "code",
  380. "operator": "in",
  381. "value": [
  382. 401,
  383. 403
  384. ]
  385. },
  386. {
  387. "responseField": "msg",
  388. "operator": "contains",
  389. "value": [
  390. "unauthorized",
  391. "token",
  392. "invalid",
  393. "auth"
  394. ]
  395. }
  396. ],
  397. "matchMode": "any",
  398. "trigger": "tokenConfig.onMissing"
  399. }
  400. }
  401. }