api-config.json 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. {
  2. "name": "category-tree",
  3. "displayName": "Amazon 类目树查询",
  4. "description": "获取 Amazon 类目层级树结构,用于定位目标品类的类目 ID,再通过 category_products 获取该类目下的产品列表。",
  5. "category": "voc",
  6. "version": "1.3.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/voc-ecom/forward",
  10. "headers": {
  11. "Content-Type": "application/json",
  12. "Authorization": "Bearer {{vocToken}}"
  13. }
  14. },
  15. "parameters": {
  16. "type": "object",
  17. "properties": {
  18. "domain": {
  19. "type": "integer",
  20. "description": "Amazon 站点 ID: 1=amazon.com",
  21. "default": 1
  22. }
  23. }
  24. },
  25. "requestTransform": {
  26. "template": {
  27. "path": "/api/CategoryTree",
  28. "method": "POST",
  29. "query": {
  30. "domain": "{{domain}}"
  31. },
  32. "body": {}
  33. }
  34. },
  35. "response": {
  36. "type": "array",
  37. "description": "类目树节点数组",
  38. "items": {
  39. "type": "object",
  40. "properties": {
  41. "NodeId": {
  42. "type": "string",
  43. "description": "类目节点 ID"
  44. },
  45. "Name": {
  46. "type": "string",
  47. "description": "类目名称"
  48. },
  49. "Children": {
  50. "type": "array",
  51. "description": "子类目列表"
  52. }
  53. }
  54. }
  55. },
  56. "relatedSkills": [
  57. "category_products"
  58. ],
  59. "usageExamples": [
  60. {
  61. "name": "获取美国站类目树",
  62. "input": {
  63. "domain": 1
  64. },
  65. "description": "获取 amazon.com 的完整类目层级结构"
  66. }
  67. ],
  68. "reportMapping": {
  69. "slides": [
  70. "市场全景(Slide3)"
  71. ],
  72. "dataPoints": [
  73. "品类类目定位"
  74. ]
  75. },
  76. "timeout": 60000,
  77. "retry": {
  78. "maxAttempts": 3,
  79. "delay": 1000,
  80. "backoffMultiplier": 2
  81. },
  82. "tokenConfig": {
  83. "type": "bearer",
  84. "configFile": "~/.openclaw/voc-credentials.json",
  85. "tokenField": "vocToken",
  86. "resolutionOrder": [
  87. "configFile"
  88. ],
  89. "apigId": "7HwdQZk55B",
  90. "paymentUrlResolution": {
  91. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  92. "steps": [
  93. "1. 从 voc-credentials.json 获取当前 session token",
  94. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  95. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  96. "4. 将该URL展示给用户,引导扫码支付"
  97. ],
  98. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  99. "userResolveHeaders": {
  100. "X-Parse-Application-Id": "ncloudmaster",
  101. "X-Parse-Session-Token": "{vocToken}"
  102. },
  103. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  104. "paymentParams": {
  105. "user": "{resolvedUserId}",
  106. "apigid": "7HwdQZk55B",
  107. "fun_id": "HOkkX72PMF"
  108. },
  109. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  110. },
  111. "onMissing": {
  112. "action": "showPaymentQR",
  113. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  114. "title": "扫码开通 VOC-AI 数据服务",
  115. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  116. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  117. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  118. },
  119. "onBalanceInsufficient": {
  120. "action": "resolveUserThenShowPayment",
  121. "title": "VOC-AI Token 余额不足,请扫码充值",
  122. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  123. }
  124. },
  125. "errorHandling": {
  126. "balanceInsufficient": {
  127. "conditions": [
  128. {
  129. "responseField": "code",
  130. "operator": "in",
  131. "value": [
  132. -2,
  133. -3,
  134. -10,
  135. 402,
  136. 429
  137. ]
  138. },
  139. {
  140. "responseField": "msg",
  141. "operator": "contains",
  142. "value": [
  143. "余额不足",
  144. "insufficient",
  145. "balance",
  146. "quota",
  147. "没有开通",
  148. "权限或余额"
  149. ]
  150. },
  151. {
  152. "responseField": "mess",
  153. "operator": "contains",
  154. "value": [
  155. "余额不足",
  156. "insufficient",
  157. "balance",
  158. "quota",
  159. "没有开通",
  160. "权限或余额"
  161. ]
  162. },
  163. {
  164. "responseField": "message",
  165. "operator": "contains",
  166. "value": [
  167. "余额不足",
  168. "insufficient",
  169. "balance",
  170. "没有开通",
  171. "权限或余额"
  172. ]
  173. }
  174. ],
  175. "matchMode": "any",
  176. "trigger": "tokenConfig.onBalanceInsufficient"
  177. },
  178. "unauthorized": {
  179. "conditions": [
  180. {
  181. "responseField": "code",
  182. "operator": "in",
  183. "value": [
  184. 401,
  185. 403
  186. ]
  187. },
  188. {
  189. "responseField": "msg",
  190. "operator": "contains",
  191. "value": [
  192. "unauthorized",
  193. "token",
  194. "invalid",
  195. "auth"
  196. ]
  197. }
  198. ],
  199. "matchMode": "any",
  200. "trigger": "tokenConfig.onMissing"
  201. }
  202. }
  203. }