api-config.json 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. {
  2. "name": "competitor-pricing-analysis",
  3. "displayName": "竞品定价策略分析",
  4. "description": "分析竞品定价策略,包括5分位价格带分布、黄金价格带评分、毛利估算、促销建议和盈亏平衡销量分析",
  5. "category": "competitor-analysis",
  6. "version": "1.3.0",
  7. "type": "orchestration",
  8. "parameters": {
  9. "categoryKeyword": {
  10. "type": "string",
  11. "required": true,
  12. "description": "品类关键词"
  13. },
  14. "competitorAsins": {
  15. "type": "array",
  16. "items": {
  17. "type": "string"
  18. },
  19. "required": true,
  20. "description": "竞品ASIN列表"
  21. },
  22. "ownPrice": {
  23. "type": "number",
  24. "required": false,
  25. "description": "自身产品当前价格,用于对比定位"
  26. },
  27. "domain": {
  28. "type": "integer",
  29. "required": false,
  30. "default": 1,
  31. "description": "Amazon站点(1=美国)"
  32. }
  33. },
  34. "pipeline": [
  35. {
  36. "step": 1,
  37. "name": "搜索品类Top100产品价格数据",
  38. "api": {
  39. "service": "SorftimeApiService.searchProductsByQuery",
  40. "endpoint": "/api/ProductQuery",
  41. "method": "POST",
  42. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  43. "headers": {
  44. "Authorization": "Bearer {{vocToken}}"
  45. },
  46. "requestBody": {
  47. "Page": 1,
  48. "Query": "1",
  49. "QueryType": "7",
  50. "Pattern": "${categoryKeyword}"
  51. },
  52. "queryParams": {
  53. "domain": "${domain}"
  54. }
  55. },
  56. "output": "categoryProducts",
  57. "responseExtract": "Array<{ Asin, Title, Price, Rating, RatingsCount, MonthlySales, Brand, BSR }>"
  58. },
  59. {
  60. "step": 2,
  61. "name": "批量获取竞品详细定价信息",
  62. "forEach": "competitorAsins",
  63. "api": {
  64. "service": "SorftimeApiService.getProductDetail",
  65. "endpoint": "/api/ProductRequest",
  66. "method": "POST",
  67. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  68. "headers": {
  69. "Authorization": "Bearer {{vocToken}}"
  70. },
  71. "requestBody": {
  72. "ASIN": "${asin}",
  73. "Trend": 1,
  74. "QueryTrendStartDt": "",
  75. "QueryTrendEndDt": ""
  76. },
  77. "queryParams": {
  78. "domain": "${domain}"
  79. }
  80. },
  81. "output": "competitorDetails",
  82. "responseExtract": "{ Title, Brand, SalesPrice, ListPrice, CouponInfo, FBAFee, Ratings, RatingsCount, MonthlySales }"
  83. },
  84. {
  85. "step": 3,
  86. "name": "获取竞品历史价格趋势",
  87. "forEach": "competitorAsins",
  88. "api": {
  89. "service": "SorftimeApiService.getMonitorData",
  90. "endpoint": "/api/MonitorQuery",
  91. "method": "POST",
  92. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  93. "headers": {
  94. "Authorization": "Bearer {{vocToken}}"
  95. },
  96. "requestBody": {
  97. "ASIN": "${asin}"
  98. },
  99. "queryParams": {
  100. "domain": "${domain}"
  101. }
  102. },
  103. "output": "priceHistory",
  104. "responseExtract": "{ PriceHistory, RankHistory }"
  105. },
  106. {
  107. "step": 4,
  108. "name": "5分位价格带分析",
  109. "type": "compute",
  110. "logic": "analyzePriceBands(categoryProducts)",
  111. "algorithm": {
  112. "quintile": "按P20/P40/P60/P80划分为低价带/中低/黄金中价/中高/高价带",
  113. "perBand": "每带统计: skuCount, avgSales, avgRating, avgBsr",
  114. "goldenBandScore": "bandScore = avgSales×0.5 + avgRating×20 + (skuCount>0?10:0),最高分为量利平衡最优带"
  115. },
  116. "output": "priceBands"
  117. },
  118. {
  119. "step": 5,
  120. "name": "竞品定价策略识别+毛利估算",
  121. "type": "compute",
  122. "logic": "analyzeCompetitorPricing(competitorDetails, priceHistory, priceBands, ownPrice)",
  123. "algorithm": {
  124. "pricingStrategy": "渗透定价(低于P20)/跟随定价(黄金带内)/溢价定价(高于P80)",
  125. "marginEstimate": "15%佣金+$5FBA+30%采购成本 → grossMargin%, 盈亏平衡销量",
  126. "ownPosition": "自身价格在哪个价格带的哪个百分位",
  127. "optimalPrice": "goldenBandMin + (goldenBandMax-goldenBandMin)*0.6 * min(1.15, max(0.85, selfRating/bandAvgRating))",
  128. "promotionAdvice": "价格战风险检测,优先多件折扣/满减替代降价"
  129. },
  130. "output": "pricingAnalysis"
  131. }
  132. ],
  133. "response": {
  134. "type": "object",
  135. "properties": {
  136. "priceBands": {
  137. "type": "array",
  138. "description": "5分位价格带分布",
  139. "items": {
  140. "type": "object",
  141. "properties": {
  142. "range": {
  143. "type": "string"
  144. },
  145. "label": {
  146. "type": "string"
  147. },
  148. "productCount": {
  149. "type": "integer"
  150. },
  151. "avgRating": {
  152. "type": "number"
  153. },
  154. "avgSales": {
  155. "type": "integer"
  156. },
  157. "isGolden": {
  158. "type": "boolean"
  159. }
  160. }
  161. }
  162. },
  163. "competitorPricing": {
  164. "type": "array",
  165. "description": "竞品定价详情",
  166. "items": {
  167. "type": "object",
  168. "properties": {
  169. "asin": {
  170. "type": "string"
  171. },
  172. "brand": {
  173. "type": "string"
  174. },
  175. "currentPrice": {
  176. "type": "number"
  177. },
  178. "listPrice": {
  179. "type": "number"
  180. },
  181. "coupon": {
  182. "type": "number"
  183. },
  184. "pricingStrategy": {
  185. "type": "string"
  186. },
  187. "priceHistory": {
  188. "type": "array"
  189. },
  190. "estimatedMargin": {
  191. "type": "number"
  192. }
  193. }
  194. }
  195. },
  196. "ownPricePosition": {
  197. "type": "object",
  198. "properties": {
  199. "band": {
  200. "type": "string"
  201. },
  202. "percentile": {
  203. "type": "number"
  204. },
  205. "competitiveness": {
  206. "type": "string"
  207. }
  208. }
  209. },
  210. "recommendation": {
  211. "type": "object",
  212. "properties": {
  213. "optimalRange": {
  214. "type": "array",
  215. "items": {
  216. "type": "number"
  217. }
  218. },
  219. "goldenBand": {
  220. "type": "string"
  221. },
  222. "strategy": {
  223. "type": "string"
  224. },
  225. "reasons": {
  226. "type": "array",
  227. "items": {
  228. "type": "string"
  229. }
  230. }
  231. }
  232. },
  233. "marginEstimate": {
  234. "type": "object",
  235. "properties": {
  236. "currentMargin": {
  237. "type": "number"
  238. },
  239. "suggestedMargin": {
  240. "type": "number"
  241. },
  242. "breakEvenSales": {
  243. "type": "integer"
  244. }
  245. }
  246. },
  247. "promotionAdvice": {
  248. "type": "array",
  249. "items": {
  250. "type": "string"
  251. }
  252. }
  253. }
  254. },
  255. "timeout": 120000,
  256. "retry": {
  257. "maxAttempts": 2,
  258. "delay": 2000,
  259. "backoffMultiplier": 2
  260. },
  261. "tokenConfig": {
  262. "type": "bearer",
  263. "configFile": "~/.openclaw/voc-credentials.json",
  264. "tokenField": "vocToken",
  265. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  266. "resolutionOrder": [
  267. "configFile",
  268. "currentToken"
  269. ],
  270. "apigId": "Vo3ROWEvDy",
  271. "paymentUrlResolution": {
  272. "description": "动态构建充值URL:通过当前token查出用户objectId,拼接到充值页面",
  273. "steps": [
  274. "1. 从 voc-credentials.json 或 currentToken 获取当前 session token",
  275. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  276. "3. 拼接充值URL: https://pwa.fmode.cn/apig-pay.html?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  277. "4. 将该URL展示给用户,引导扫码支付"
  278. ],
  279. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  280. "userResolveHeaders": {
  281. "X-Parse-Application-Id": "ncloudmaster",
  282. "X-Parse-Session-Token": "{vocToken}"
  283. },
  284. "paymentBaseUrl": "https://pwa.fmode.cn/apig-pay.html",
  285. "paymentParams": {
  286. "user": "{resolvedUserId}",
  287. "apigid": "Vo3ROWEvDy",
  288. "fun_id": "HOkkX72PMF"
  289. },
  290. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  291. },
  292. "onMissing": {
  293. "action": "resolveUserThenShowPayment",
  294. "title": "扫码开通 VOC-AI 数据服务",
  295. "message": "此 Skill 需要有效的 API Token。请按以下步骤操作:\n1. 如果你已有 Token,请告诉我,我会保存到 ~/.openclaw/voc-credentials.json\n2. 如果没有 Token,我会引导你扫码充值开通"
  296. },
  297. "onBalanceInsufficient": {
  298. "action": "resolveUserThenShowPayment",
  299. "title": "VOC-AI Token 余额不足,请扫码充值",
  300. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  301. }
  302. },
  303. "errorHandling": {
  304. "balanceInsufficient": {
  305. "conditions": [
  306. {
  307. "responseField": "code",
  308. "operator": "in",
  309. "value": [
  310. -2,
  311. -3,
  312. -10,
  313. 402,
  314. 429
  315. ]
  316. },
  317. {
  318. "responseField": "msg",
  319. "operator": "contains",
  320. "value": [
  321. "余额不足",
  322. "insufficient",
  323. "balance",
  324. "quota"
  325. ]
  326. },
  327. {
  328. "responseField": "message",
  329. "operator": "contains",
  330. "value": [
  331. "余额不足",
  332. "insufficient",
  333. "balance"
  334. ]
  335. }
  336. ],
  337. "matchMode": "any",
  338. "trigger": "tokenConfig.onBalanceInsufficient"
  339. },
  340. "unauthorized": {
  341. "conditions": [
  342. {
  343. "responseField": "code",
  344. "operator": "in",
  345. "value": [
  346. 401,
  347. 403
  348. ]
  349. },
  350. {
  351. "responseField": "msg",
  352. "operator": "contains",
  353. "value": [
  354. "unauthorized",
  355. "token",
  356. "invalid",
  357. "auth"
  358. ]
  359. }
  360. ],
  361. "matchMode": "any",
  362. "trigger": "tokenConfig.onMissing"
  363. }
  364. }
  365. }