api-config.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. {
  2. "name": "competitor-product-comparison",
  3. "displayName": "竞品产品对比",
  4. "description": "对自身产品与竞品进行多维度横向对比,生成5维健康度仪表盘并标注机会/风险标签",
  5. "category": "competitor-analysis",
  6. "version": "1.3.0",
  7. "type": "orchestration",
  8. "parameters": {
  9. "ownAsins": {
  10. "type": "array",
  11. "items": {
  12. "type": "string"
  13. },
  14. "required": true,
  15. "description": "自身品牌ASIN列表"
  16. },
  17. "competitorAsins": {
  18. "type": "array",
  19. "items": {
  20. "type": "string"
  21. },
  22. "required": true,
  23. "description": "竞品ASIN列表(来自 competitor-discovery 输出)"
  24. },
  25. "domain": {
  26. "type": "integer",
  27. "required": false,
  28. "default": 1,
  29. "description": "Amazon站点(1=美国)"
  30. },
  31. "dimensions": {
  32. "type": "array",
  33. "items": {
  34. "type": "string"
  35. },
  36. "required": false,
  37. "description": "对比维度,默认全部"
  38. }
  39. },
  40. "pipeline": [
  41. {
  42. "step": 1,
  43. "name": "批量获取所有ASIN产品详情",
  44. "forEach": "ownAsins + competitorAsins",
  45. "api": {
  46. "service": "SorftimeApiService.getProductDetail",
  47. "endpoint": "/api/ProductRequest",
  48. "method": "POST",
  49. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  50. "headers": {
  51. "Authorization": "Bearer {{vocToken}}"
  52. },
  53. "requestBody": {
  54. "ASIN": "${asin}",
  55. "Trend": 1,
  56. "QueryTrendStartDt": "",
  57. "QueryTrendEndDt": ""
  58. },
  59. "queryParams": {
  60. "domain": "${domain}"
  61. }
  62. },
  63. "output": "allProductDetails",
  64. "responseExtract": "{ Title, Brand, SalesPrice, Ratings, RatingsCount, BSR, Category, Photo, Feature, Description, VariationASIN, MonthlySales }"
  65. },
  66. {
  67. "step": 2,
  68. "name": "批量获取销量数据",
  69. "forEach": "ownAsins + competitorAsins",
  70. "api": {
  71. "service": "SorftimeApiService.getAsinSalesVolume",
  72. "endpoint": "/api/AsinSalesVolume",
  73. "method": "POST",
  74. "requestBody": {
  75. "ASIN": "${asin}"
  76. },
  77. "queryParams": {
  78. "domain": "${domain}"
  79. }
  80. },
  81. "output": "salesData"
  82. },
  83. {
  84. "step": 3,
  85. "name": "多维度对比矩阵计算",
  86. "type": "compute",
  87. "logic": "buildComparisonMatrix(allProductDetails, salesData, ownAsins)",
  88. "algorithm": {
  89. "dimensions": {
  90. "price": "售价、历史价格趋势、折扣力度",
  91. "rating": "平均分、评论数、星级分布(1-5星占比)",
  92. "sales": "月销量、日销量趋势、BSR排名",
  93. "product": "标题关键词、卖点Feature、图片数量、A+页面",
  94. "brand": "品牌店铺、FBA/FBM、发货地",
  95. "variant": "变体数量、尺寸/颜色选项"
  96. },
  97. "scoring": "各维度竞争力得分(0-100)"
  98. },
  99. "output": "comparisonMatrix"
  100. },
  101. {
  102. "step": 4,
  103. "name": "5维健康度评估",
  104. "type": "compute",
  105. "logic": "calcHealthDashboard(comparisonMatrix, ownAsins)",
  106. "algorithm": {
  107. "weights": {
  108. "pricingCompetitiveness": 0.2,
  109. "ratingHealth": 0.25,
  110. "trafficRank": 0.2,
  111. "salesEfficiency": 0.15,
  112. "growthPotential": 0.2
  113. },
  114. "tags": "每个产品生成机会标签 + 风险标签",
  115. "coreShortcoming": "识别最低分维度作为核心短板"
  116. },
  117. "output": "healthDashboard"
  118. }
  119. ],
  120. "response": {
  121. "type": "object",
  122. "properties": {
  123. "comparisonMatrix": {
  124. "type": "array",
  125. "description": "对比矩阵",
  126. "items": {
  127. "type": "object",
  128. "properties": {
  129. "asin": {
  130. "type": "string"
  131. },
  132. "brand": {
  133. "type": "string"
  134. },
  135. "isOwn": {
  136. "type": "boolean"
  137. },
  138. "metrics": {
  139. "type": "object",
  140. "properties": {
  141. "price": {
  142. "type": "object",
  143. "properties": {
  144. "value": {
  145. "type": "number"
  146. },
  147. "score": {
  148. "type": "integer"
  149. }
  150. }
  151. },
  152. "rating": {
  153. "type": "object",
  154. "properties": {
  155. "value": {
  156. "type": "number"
  157. },
  158. "score": {
  159. "type": "integer"
  160. }
  161. }
  162. },
  163. "monthlySales": {
  164. "type": "object",
  165. "properties": {
  166. "value": {
  167. "type": "integer"
  168. },
  169. "score": {
  170. "type": "integer"
  171. }
  172. }
  173. },
  174. "reviewCount": {
  175. "type": "object",
  176. "properties": {
  177. "value": {
  178. "type": "integer"
  179. },
  180. "score": {
  181. "type": "integer"
  182. }
  183. }
  184. },
  185. "bsr": {
  186. "type": "object",
  187. "properties": {
  188. "value": {
  189. "type": "integer"
  190. },
  191. "score": {
  192. "type": "integer"
  193. }
  194. }
  195. },
  196. "featureCount": {
  197. "type": "object",
  198. "properties": {
  199. "value": {
  200. "type": "integer"
  201. },
  202. "score": {
  203. "type": "integer"
  204. }
  205. }
  206. },
  207. "variantCount": {
  208. "type": "object",
  209. "properties": {
  210. "value": {
  211. "type": "integer"
  212. },
  213. "score": {
  214. "type": "integer"
  215. }
  216. }
  217. }
  218. }
  219. },
  220. "overallScore": {
  221. "type": "number"
  222. }
  223. }
  224. }
  225. },
  226. "advantages": {
  227. "type": "array",
  228. "items": {
  229. "type": "string"
  230. }
  231. },
  232. "gaps": {
  233. "type": "array",
  234. "items": {
  235. "type": "string"
  236. }
  237. },
  238. "recommendation": {
  239. "type": "string"
  240. },
  241. "healthDashboard": {
  242. "type": "object",
  243. "description": "5维健康度仪表盘,key为ASIN",
  244. "additionalProperties": {
  245. "type": "object",
  246. "properties": {
  247. "overallScore": {
  248. "type": "number"
  249. },
  250. "dimensions": {
  251. "type": "object",
  252. "properties": {
  253. "pricingCompetitiveness": {
  254. "type": "integer"
  255. },
  256. "ratingHealth": {
  257. "type": "integer"
  258. },
  259. "trafficRank": {
  260. "type": "integer"
  261. },
  262. "salesEfficiency": {
  263. "type": "integer"
  264. },
  265. "growthPotential": {
  266. "type": "integer"
  267. }
  268. }
  269. },
  270. "opportunityTags": {
  271. "type": "array",
  272. "items": {
  273. "type": "string"
  274. }
  275. },
  276. "riskTags": {
  277. "type": "array",
  278. "items": {
  279. "type": "string"
  280. }
  281. },
  282. "coreShortcoming": {
  283. "type": "string"
  284. }
  285. }
  286. }
  287. }
  288. }
  289. },
  290. "timeout": 120000,
  291. "retry": {
  292. "maxAttempts": 2,
  293. "delay": 2000,
  294. "backoffMultiplier": 2
  295. },
  296. "tokenConfig": {
  297. "type": "bearer",
  298. "configFile": "~/.openclaw/voc-credentials.json",
  299. "tokenField": "vocToken",
  300. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  301. "resolutionOrder": [
  302. "configFile",
  303. "currentToken"
  304. ],
  305. "apigId": "Vo3ROWEvDy",
  306. "paymentUrlResolution": {
  307. "description": "动态构建充值URL:通过当前token查出用户objectId,拼接到充值页面",
  308. "steps": [
  309. "1. 从 voc-credentials.json 或 currentToken 获取当前 session token",
  310. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  311. "3. 拼接充值URL: https://pwa.fmode.cn/apig-pay.html?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  312. "4. 将该URL展示给用户,引导扫码支付"
  313. ],
  314. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  315. "userResolveHeaders": {
  316. "X-Parse-Application-Id": "ncloudmaster",
  317. "X-Parse-Session-Token": "{vocToken}"
  318. },
  319. "paymentBaseUrl": "https://pwa.fmode.cn/apig-pay.html",
  320. "paymentParams": {
  321. "user": "{resolvedUserId}",
  322. "apigid": "Vo3ROWEvDy",
  323. "fun_id": "HOkkX72PMF"
  324. },
  325. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  326. },
  327. "onMissing": {
  328. "action": "resolveUserThenShowPayment",
  329. "title": "扫码开通 VOC-AI 数据服务",
  330. "message": "此 Skill 需要有效的 API Token。请按以下步骤操作:\n1. 如果你已有 Token,请告诉我,我会保存到 ~/.openclaw/voc-credentials.json\n2. 如果没有 Token,我会引导你扫码充值开通"
  331. },
  332. "onBalanceInsufficient": {
  333. "action": "resolveUserThenShowPayment",
  334. "title": "VOC-AI Token 余额不足,请扫码充值",
  335. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  336. }
  337. },
  338. "errorHandling": {
  339. "balanceInsufficient": {
  340. "conditions": [
  341. {
  342. "responseField": "code",
  343. "operator": "in",
  344. "value": [
  345. -2,
  346. -3,
  347. -10,
  348. 402,
  349. 429
  350. ]
  351. },
  352. {
  353. "responseField": "msg",
  354. "operator": "contains",
  355. "value": [
  356. "余额不足",
  357. "insufficient",
  358. "balance",
  359. "quota"
  360. ]
  361. },
  362. {
  363. "responseField": "message",
  364. "operator": "contains",
  365. "value": [
  366. "余额不足",
  367. "insufficient",
  368. "balance"
  369. ]
  370. }
  371. ],
  372. "matchMode": "any",
  373. "trigger": "tokenConfig.onBalanceInsufficient"
  374. },
  375. "unauthorized": {
  376. "conditions": [
  377. {
  378. "responseField": "code",
  379. "operator": "in",
  380. "value": [
  381. 401,
  382. 403
  383. ]
  384. },
  385. {
  386. "responseField": "msg",
  387. "operator": "contains",
  388. "value": [
  389. "unauthorized",
  390. "token",
  391. "invalid",
  392. "auth"
  393. ]
  394. }
  395. ],
  396. "matchMode": "any",
  397. "trigger": "tokenConfig.onMissing"
  398. }
  399. }
  400. }