api-config.json 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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": ["configFile", "currentToken"],
  88. "onMissing": {
  89. "action": "showPaymentQR",
  90. "qrCodeUrl": "https://pwa.fmode.cn/apig-pay.html?user={{user}}&apigid={{apigid}}&fun_id=HOkkX72PMF",
  91. "paymentCheckEndpoint": "https://server.fmode.cn/api/apig/getApig",
  92. "pollingIntervalMs": 3000,
  93. "pollingTimeoutMs": 300000,
  94. "onPaymentSuccess": "retrySkillWithNewToken",
  95. "title": "扫码开通 VOC-AI 数据服务",
  96. "message": "请扫描下方二维码完成支付,支付成功后将自动获取 Token 并继续执行。"
  97. },
  98. "onBalanceInsufficient": {
  99. "action": "showPaymentQR",
  100. "qrCodeUrl": "https://pwa.fmode.cn/apig-pay.html?user={{user}}&apigid={{apigid}}&fun_id=HOkkX72PMF",
  101. "paymentCheckEndpoint": "https://server.fmode.cn/api/apig/getApig",
  102. "pollingIntervalMs": 3000,
  103. "pollingTimeoutMs": 300000,
  104. "onPaymentSuccess": "retrySkillWithNewToken",
  105. "title": "VOC-AI Token 余额不足,请扫码充值",
  106. "message": "当前 Token 余额不足,请扫描二维码充值,支付完成后将自动继续执行。"
  107. }
  108. },
  109. "errorHandling": {
  110. "balanceInsufficient": {
  111. "conditions": [
  112. { "responseField": "code", "operator": "in", "value": [-2, -3, -10, 402, 429] },
  113. { "responseField": "msg", "operator": "contains", "value": ["余额不足", "insufficient", "balance", "quota"] },
  114. { "responseField": "message", "operator": "contains", "value": ["余额不足", "insufficient", "balance"] }
  115. ],
  116. "matchMode": "any",
  117. "trigger": "tokenConfig.onBalanceInsufficient"
  118. },
  119. "unauthorized": {
  120. "conditions": [
  121. { "responseField": "code", "operator": "in", "value": [401, 403] },
  122. { "responseField": "msg", "operator": "contains", "value": ["unauthorized", "token", "invalid", "auth"] }
  123. ],
  124. "matchMode": "any",
  125. "trigger": "tokenConfig.onMissing"
  126. }
  127. }
  128. }