api-config.json 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  87. "resolutionOrder": [
  88. "configFile",
  89. "currentToken"
  90. ],
  91. "apigId": "Vo3ROWEvDy",
  92. "paymentUrlResolution": {
  93. "description": "动态构建充值URL:通过当前token查出用户objectId,拼接到充值页面",
  94. "steps": [
  95. "1. 从 voc-credentials.json 或 currentToken 获取当前 session token",
  96. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  97. "3. 拼接充值URL: https://pwa.fmode.cn/apig-pay.html?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  98. "4. 将该URL展示给用户,引导扫码支付"
  99. ],
  100. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  101. "userResolveHeaders": {
  102. "X-Parse-Application-Id": "ncloudmaster",
  103. "X-Parse-Session-Token": "{vocToken}"
  104. },
  105. "paymentBaseUrl": "https://pwa.fmode.cn/apig-pay.html",
  106. "paymentParams": {
  107. "user": "{resolvedUserId}",
  108. "apigid": "Vo3ROWEvDy",
  109. "fun_id": "HOkkX72PMF"
  110. },
  111. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  112. },
  113. "onMissing": {
  114. "action": "resolveUserThenShowPayment",
  115. "title": "扫码开通 VOC-AI 数据服务",
  116. "message": "此 Skill 需要有效的 API Token。请按以下步骤操作:\n1. 如果你已有 Token,请告诉我,我会保存到 ~/.openclaw/voc-credentials.json\n2. 如果没有 Token,我会引导你扫码充值开通"
  117. },
  118. "onBalanceInsufficient": {
  119. "action": "resolveUserThenShowPayment",
  120. "title": "VOC-AI Token 余额不足,请扫码充值",
  121. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  122. }
  123. },
  124. "errorHandling": {
  125. "balanceInsufficient": {
  126. "conditions": [
  127. {
  128. "responseField": "code",
  129. "operator": "in",
  130. "value": [
  131. -2,
  132. -3,
  133. -10,
  134. 402,
  135. 429
  136. ]
  137. },
  138. {
  139. "responseField": "msg",
  140. "operator": "contains",
  141. "value": [
  142. "余额不足",
  143. "insufficient",
  144. "balance",
  145. "quota"
  146. ]
  147. },
  148. {
  149. "responseField": "message",
  150. "operator": "contains",
  151. "value": [
  152. "余额不足",
  153. "insufficient",
  154. "balance"
  155. ]
  156. }
  157. ],
  158. "matchMode": "any",
  159. "trigger": "tokenConfig.onBalanceInsufficient"
  160. },
  161. "unauthorized": {
  162. "conditions": [
  163. {
  164. "responseField": "code",
  165. "operator": "in",
  166. "value": [
  167. 401,
  168. 403
  169. ]
  170. },
  171. {
  172. "responseField": "msg",
  173. "operator": "contains",
  174. "value": [
  175. "unauthorized",
  176. "token",
  177. "invalid",
  178. "auth"
  179. ]
  180. }
  181. ],
  182. "matchMode": "any",
  183. "trigger": "tokenConfig.onMissing"
  184. }
  185. }
  186. }