api-config.json 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  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. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  367. "resolutionOrder": [
  368. "configFile",
  369. "currentToken"
  370. ],
  371. "apigId": "Vo3ROWEvDy",
  372. "paymentUrlResolution": {
  373. "description": "动态构建充值URL:通过当前token查出用户objectId,拼接到充值页面",
  374. "steps": [
  375. "1. 从 voc-credentials.json 或 currentToken 获取当前 session token",
  376. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  377. "3. 拼接充值URL: https://pwa.fmode.cn/apig-pay.html?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  378. "4. 将该URL展示给用户,引导扫码支付"
  379. ],
  380. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  381. "userResolveHeaders": {
  382. "X-Parse-Application-Id": "ncloudmaster",
  383. "X-Parse-Session-Token": "{vocToken}"
  384. },
  385. "paymentBaseUrl": "https://pwa.fmode.cn/apig-pay.html",
  386. "paymentParams": {
  387. "user": "{resolvedUserId}",
  388. "apigid": "Vo3ROWEvDy",
  389. "fun_id": "HOkkX72PMF"
  390. },
  391. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  392. },
  393. "onMissing": {
  394. "action": "resolveUserThenShowPayment",
  395. "title": "扫码开通 VOC-AI 数据服务",
  396. "message": "此 Skill 需要有效的 API Token。请按以下步骤操作:\n1. 如果你已有 Token,请告诉我,我会保存到 ~/.openclaw/voc-credentials.json\n2. 如果没有 Token,我会引导你扫码充值开通"
  397. },
  398. "onBalanceInsufficient": {
  399. "action": "resolveUserThenShowPayment",
  400. "title": "VOC-AI Token 余额不足,请扫码充值",
  401. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  402. }
  403. },
  404. "errorHandling": {
  405. "balanceInsufficient": {
  406. "conditions": [
  407. {
  408. "responseField": "code",
  409. "operator": "in",
  410. "value": [
  411. -2,
  412. -3,
  413. -10,
  414. 402,
  415. 429
  416. ]
  417. },
  418. {
  419. "responseField": "msg",
  420. "operator": "contains",
  421. "value": [
  422. "余额不足",
  423. "insufficient",
  424. "balance",
  425. "quota"
  426. ]
  427. },
  428. {
  429. "responseField": "message",
  430. "operator": "contains",
  431. "value": [
  432. "余额不足",
  433. "insufficient",
  434. "balance"
  435. ]
  436. }
  437. ],
  438. "matchMode": "any",
  439. "trigger": "tokenConfig.onBalanceInsufficient"
  440. },
  441. "unauthorized": {
  442. "conditions": [
  443. {
  444. "responseField": "code",
  445. "operator": "in",
  446. "value": [
  447. 401,
  448. 403
  449. ]
  450. },
  451. {
  452. "responseField": "msg",
  453. "operator": "contains",
  454. "value": [
  455. "unauthorized",
  456. "token",
  457. "invalid",
  458. "auth"
  459. ]
  460. }
  461. ],
  462. "matchMode": "any",
  463. "trigger": "tokenConfig.onMissing"
  464. }
  465. }
  466. }