api-config.json 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  1. {
  2. "name": "brand-profile",
  3. "displayName": "品牌六维画像",
  4. "description": "生成品牌六维量化画像,标注机会/风险标签、识别核心短板、输出竞争定位建议和《品牌认知校准卡》",
  5. "category": "synthesis",
  6. "version": "1.3.0",
  7. "type": "orchestration",
  8. "parameters": {
  9. "brandName": {
  10. "type": "string",
  11. "required": true,
  12. "description": "品牌名称"
  13. },
  14. "brandAsins": {
  15. "type": "array",
  16. "items": {
  17. "type": "string"
  18. },
  19. "required": true,
  20. "description": "品牌核心ASIN列表"
  21. },
  22. "categoryKeyword": {
  23. "type": "string",
  24. "required": true,
  25. "description": "品类关键词(用于品类基准对比)"
  26. },
  27. "categoryLandscape": {
  28. "type": "object",
  29. "required": false,
  30. "description": "category-landscape 输出(如有则跳过重复查询)"
  31. },
  32. "domain": {
  33. "type": "integer",
  34. "required": false,
  35. "default": 1,
  36. "description": "Amazon站点(1=美国)"
  37. }
  38. },
  39. "pipeline": [
  40. {
  41. "step": 1,
  42. "name": "批量获取品牌产品详情",
  43. "forEach": "brandAsins",
  44. "api": {
  45. "service": "SorftimeApiService.getProductDetail",
  46. "endpoint": "/api/ProductRequest",
  47. "method": "POST",
  48. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  49. "headers": {
  50. "Authorization": "Bearer {{vocToken}}"
  51. },
  52. "requestBody": {
  53. "ASIN": "${asin}",
  54. "Trend": 1,
  55. "QueryTrendStartDt": "",
  56. "QueryTrendEndDt": ""
  57. },
  58. "queryParams": {
  59. "domain": "${domain}"
  60. }
  61. },
  62. "output": "productDetails",
  63. "responseExtract": "{ Title, Brand, SalesPrice, Ratings, RatingsCount, BSR, Category, MonthlySales, fiveStartRatings, fourStartRatings, threeStartRatings, twoStartRatings, oneStartRatings }"
  64. },
  65. {
  66. "step": 2,
  67. "name": "批量获取销量数据",
  68. "forEach": "brandAsins",
  69. "api": {
  70. "service": "SorftimeApiService.getAsinSalesVolume",
  71. "endpoint": "/api/AsinSalesVolume",
  72. "method": "POST",
  73. "requestBody": {
  74. "ASIN": "${asin}"
  75. },
  76. "queryParams": {
  77. "domain": "${domain}"
  78. }
  79. },
  80. "output": "salesData"
  81. },
  82. {
  83. "step": 3,
  84. "name": "采样获取评论概况",
  85. "forEach": "brandAsins",
  86. "api": {
  87. "service": "SorftimeApiService.getProductReviews",
  88. "endpoint": "/api/ProductReviewsQuery",
  89. "method": "POST",
  90. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  91. "headers": {
  92. "Authorization": "Bearer {{vocToken}}"
  93. },
  94. "requestBody": {
  95. "ASIN": "${asin}",
  96. "PageIndex": "1"
  97. },
  98. "queryParams": {
  99. "domain": "${domain}"
  100. }
  101. },
  102. "output": "reviewSamples"
  103. },
  104. {
  105. "step": 4,
  106. "name": "获取品类基准数据(如未传入categoryLandscape)",
  107. "condition": "!categoryLandscape",
  108. "api": {
  109. "service": "SorftimeApiService.searchProductsByQuery",
  110. "endpoint": "/api/ProductQuery",
  111. "method": "POST",
  112. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  113. "headers": {
  114. "Authorization": "Bearer {{vocToken}}"
  115. },
  116. "requestBody": {
  117. "Page": 1,
  118. "Query": "1",
  119. "QueryType": "7",
  120. "Pattern": "${categoryKeyword}"
  121. },
  122. "queryParams": {
  123. "domain": "${domain}"
  124. }
  125. },
  126. "output": "categoryBaseline"
  127. },
  128. {
  129. "step": 5,
  130. "name": "六维评分计算",
  131. "type": "compute",
  132. "logic": "calcSixDimensions(productDetails, salesData, reviewSamples, categoryBaseline || categoryLandscape)",
  133. "algorithm": {
  134. "pricing": {
  135. "weight": 0.2,
  136. "method": "品牌均价 vs 品类中位价的偏离度"
  137. },
  138. "rating": {
  139. "weight": 0.2,
  140. "method": "平均评分 + 差评率(1-2星占比)"
  141. },
  142. "traffic": {
  143. "weight": 0.15,
  144. "method": "BSR中位数在品类中的百分位"
  145. },
  146. "salesEfficiency": {
  147. "weight": 0.15,
  148. "method": "品牌月销量 vs 品类均值"
  149. },
  150. "growthPotential": {
  151. "weight": 0.15,
  152. "method": "新品比例 + 销量趋势 + 品类CR5位置"
  153. },
  154. "vocReputation": {
  155. "weight": 0.15,
  156. "method": "好评率 + 评论增速 + Helpful比例"
  157. }
  158. },
  159. "output": "dimensions"
  160. },
  161. {
  162. "step": 6,
  163. "name": "竞争定位+标签+建议",
  164. "type": "compute",
  165. "logic": "generatePositioning(dimensions, productDetails, brandName)",
  166. "algorithm": {
  167. "quadrant": "四象限图坐标(价格-评分)",
  168. "opportunityTags": "从每个维度评分提取优势机会",
  169. "riskTags": "识别低分维度作为风险点",
  170. "coreShortcoming": "最低分维度的具体诊断和改进建议",
  171. "priorityActions": "按紧迫度排序的改进任务"
  172. },
  173. "output": "positioning"
  174. }
  175. ],
  176. "response": {
  177. "type": "object",
  178. "properties": {
  179. "brandName": {
  180. "type": "string"
  181. },
  182. "dimensions": {
  183. "type": "object",
  184. "description": "六维评分",
  185. "properties": {
  186. "pricing": {
  187. "type": "object",
  188. "properties": {
  189. "score": {
  190. "type": "integer"
  191. },
  192. "label": {
  193. "type": "string"
  194. },
  195. "detail": {
  196. "type": "string"
  197. }
  198. }
  199. },
  200. "rating": {
  201. "type": "object",
  202. "properties": {
  203. "score": {
  204. "type": "integer"
  205. },
  206. "label": {
  207. "type": "string"
  208. },
  209. "detail": {
  210. "type": "string"
  211. }
  212. }
  213. },
  214. "traffic": {
  215. "type": "object",
  216. "properties": {
  217. "score": {
  218. "type": "integer"
  219. },
  220. "label": {
  221. "type": "string"
  222. },
  223. "detail": {
  224. "type": "string"
  225. }
  226. }
  227. },
  228. "salesEfficiency": {
  229. "type": "object",
  230. "properties": {
  231. "score": {
  232. "type": "integer"
  233. },
  234. "label": {
  235. "type": "string"
  236. },
  237. "detail": {
  238. "type": "string"
  239. }
  240. }
  241. },
  242. "growthPotential": {
  243. "type": "object",
  244. "properties": {
  245. "score": {
  246. "type": "integer"
  247. },
  248. "label": {
  249. "type": "string"
  250. },
  251. "detail": {
  252. "type": "string"
  253. }
  254. }
  255. },
  256. "vocReputation": {
  257. "type": "object",
  258. "properties": {
  259. "score": {
  260. "type": "integer"
  261. },
  262. "label": {
  263. "type": "string"
  264. },
  265. "detail": {
  266. "type": "string"
  267. }
  268. }
  269. }
  270. }
  271. },
  272. "overallScore": {
  273. "type": "number"
  274. },
  275. "positioning": {
  276. "type": "object",
  277. "properties": {
  278. "quadrant": {
  279. "type": "string"
  280. },
  281. "x": {
  282. "type": "number"
  283. },
  284. "y": {
  285. "type": "number"
  286. },
  287. "xLabel": {
  288. "type": "string"
  289. },
  290. "yLabel": {
  291. "type": "string"
  292. }
  293. }
  294. },
  295. "strengths": {
  296. "type": "array",
  297. "items": {
  298. "type": "string"
  299. }
  300. },
  301. "weaknesses": {
  302. "type": "array",
  303. "items": {
  304. "type": "string"
  305. }
  306. },
  307. "opportunityTags": {
  308. "type": "array",
  309. "items": {
  310. "type": "string"
  311. }
  312. },
  313. "riskTags": {
  314. "type": "array",
  315. "items": {
  316. "type": "string"
  317. }
  318. },
  319. "coreShortcoming": {
  320. "type": "object",
  321. "properties": {
  322. "dimension": {
  323. "type": "string"
  324. },
  325. "score": {
  326. "type": "integer"
  327. },
  328. "diagnosis": {
  329. "type": "string"
  330. },
  331. "advice": {
  332. "type": "string"
  333. }
  334. }
  335. },
  336. "priorityActions": {
  337. "type": "array",
  338. "items": {
  339. "type": "object",
  340. "properties": {
  341. "action": {
  342. "type": "string"
  343. },
  344. "priority": {
  345. "type": "integer"
  346. }
  347. }
  348. }
  349. },
  350. "calibrationCard": {
  351. "type": "string",
  352. "description": "品牌认知校准卡(Markdown格式)"
  353. }
  354. }
  355. },
  356. "timeout": 300000,
  357. "retry": {
  358. "maxAttempts": 2,
  359. "delay": 2000,
  360. "backoffMultiplier": 2
  361. },
  362. "tokenConfig": {
  363. "type": "bearer",
  364. "configFile": "~/.openclaw/voc-credentials.json",
  365. "tokenField": "vocToken",
  366. "resolutionOrder": [
  367. "configFile"
  368. ],
  369. "apigId": "7HwdQZk55B",
  370. "paymentUrlResolution": {
  371. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  372. "steps": [
  373. "1. 从 voc-credentials.json 获取当前 session token",
  374. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  375. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  376. "4. 将该URL展示给用户,引导扫码支付"
  377. ],
  378. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  379. "userResolveHeaders": {
  380. "X-Parse-Application-Id": "ncloudmaster",
  381. "X-Parse-Session-Token": "{vocToken}"
  382. },
  383. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  384. "paymentParams": {
  385. "user": "{resolvedUserId}",
  386. "apigid": "7HwdQZk55B",
  387. "fun_id": "HOkkX72PMF"
  388. },
  389. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  390. },
  391. "onMissing": {
  392. "action": "showPaymentQR",
  393. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  394. "title": "扫码开通 VOC-AI 数据服务",
  395. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  396. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  397. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  398. },
  399. "onBalanceInsufficient": {
  400. "action": "resolveUserThenShowPayment",
  401. "title": "VOC-AI Token 余额不足,请扫码充值",
  402. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  403. }
  404. },
  405. "errorHandling": {
  406. "balanceInsufficient": {
  407. "conditions": [
  408. {
  409. "responseField": "code",
  410. "operator": "in",
  411. "value": [
  412. -2,
  413. -3,
  414. -10,
  415. 402,
  416. 429
  417. ]
  418. },
  419. {
  420. "responseField": "msg",
  421. "operator": "contains",
  422. "value": [
  423. "余额不足",
  424. "insufficient",
  425. "balance",
  426. "quota",
  427. "没有开通",
  428. "权限或余额"
  429. ]
  430. },
  431. {
  432. "responseField": "mess",
  433. "operator": "contains",
  434. "value": [
  435. "余额不足",
  436. "insufficient",
  437. "balance",
  438. "quota",
  439. "没有开通",
  440. "权限或余额"
  441. ]
  442. },
  443. {
  444. "responseField": "message",
  445. "operator": "contains",
  446. "value": [
  447. "余额不足",
  448. "insufficient",
  449. "balance",
  450. "没有开通",
  451. "权限或余额"
  452. ]
  453. }
  454. ],
  455. "matchMode": "any",
  456. "trigger": "tokenConfig.onBalanceInsufficient"
  457. },
  458. "unauthorized": {
  459. "conditions": [
  460. {
  461. "responseField": "code",
  462. "operator": "in",
  463. "value": [
  464. 401,
  465. 403
  466. ]
  467. },
  468. {
  469. "responseField": "msg",
  470. "operator": "contains",
  471. "value": [
  472. "unauthorized",
  473. "token",
  474. "invalid",
  475. "auth"
  476. ]
  477. }
  478. ],
  479. "matchMode": "any",
  480. "trigger": "tokenConfig.onMissing"
  481. }
  482. }
  483. }