api-config.json 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. {
  2. "name": "keyword-search-trend",
  3. "displayName": "关键词搜索趋势查询",
  4. "description": "查询指定关键词的搜索结果趋势变化,包括搜索量随时间的变化。用于发现飙升关键词、季节性趋势分析。",
  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. "required": [
  18. "Keyword"
  19. ],
  20. "properties": {
  21. "Keyword": {
  22. "type": "string",
  23. "description": "要查询趋势的关键词"
  24. },
  25. "domain": {
  26. "type": "integer",
  27. "description": "Amazon 站点 ID: 1=amazon.com",
  28. "default": 1
  29. }
  30. }
  31. },
  32. "requestTransform": {
  33. "template": {
  34. "path": "/api/KeywordSearchResultTrend",
  35. "method": "POST",
  36. "query": {
  37. "domain": "{{domain}}"
  38. },
  39. "body": {
  40. "Keyword": "{{Keyword}}"
  41. }
  42. }
  43. },
  44. "response": {
  45. "type": "object",
  46. "description": "关键词趋势数据",
  47. "properties": {
  48. "TrendData": {
  49. "type": "array",
  50. "description": "趋势数据点列表",
  51. "items": {
  52. "type": "object",
  53. "properties": {
  54. "Date": {
  55. "type": "string",
  56. "description": "日期"
  57. },
  58. "SearchVolume": {
  59. "type": "integer",
  60. "description": "搜索量"
  61. },
  62. "ProductCount": {
  63. "type": "integer",
  64. "description": "搜索结果产品数"
  65. }
  66. }
  67. }
  68. }
  69. }
  70. },
  71. "usageExamples": [
  72. {
  73. "name": "查询关键词搜索趋势",
  74. "input": {
  75. "Keyword": "candle warmer lamp aesthetic",
  76. "domain": 1
  77. },
  78. "description": "查看 'candle warmer lamp aesthetic' 的搜索量变化趋势"
  79. }
  80. ],
  81. "reportMapping": {
  82. "slides": [
  83. "趋势雷达(Slide12)"
  84. ],
  85. "dataPoints": [
  86. "关键词搜索趋势",
  87. "飙升卖点词增幅"
  88. ]
  89. },
  90. "timeout": 60000,
  91. "retry": {
  92. "maxAttempts": 3,
  93. "delay": 1000,
  94. "backoffMultiplier": 2
  95. },
  96. "tokenConfig": {
  97. "type": "bearer",
  98. "configFile": "~/.openclaw/voc-credentials.json",
  99. "tokenField": "vocToken",
  100. "resolutionOrder": [
  101. "configFile"
  102. ],
  103. "apigId": "7HwdQZk55B",
  104. "paymentUrlResolution": {
  105. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  106. "steps": [
  107. "1. 从 voc-credentials.json 获取当前 session token",
  108. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  109. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  110. "4. 将该URL展示给用户,引导扫码支付"
  111. ],
  112. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  113. "userResolveHeaders": {
  114. "X-Parse-Application-Id": "ncloudmaster",
  115. "X-Parse-Session-Token": "{vocToken}"
  116. },
  117. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  118. "paymentParams": {
  119. "user": "{resolvedUserId}",
  120. "apigid": "7HwdQZk55B",
  121. "fun_id": "HOkkX72PMF"
  122. },
  123. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  124. },
  125. "onMissing": {
  126. "action": "showPaymentQR",
  127. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  128. "title": "扫码开通 VOC-AI 数据服务",
  129. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  130. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  131. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  132. },
  133. "onBalanceInsufficient": {
  134. "action": "resolveUserThenShowPayment",
  135. "title": "VOC-AI Token 余额不足,请扫码充值",
  136. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  137. }
  138. },
  139. "errorHandling": {
  140. "balanceInsufficient": {
  141. "conditions": [
  142. {
  143. "responseField": "code",
  144. "operator": "in",
  145. "value": [
  146. -2,
  147. -3,
  148. -10,
  149. 402,
  150. 429
  151. ]
  152. },
  153. {
  154. "responseField": "msg",
  155. "operator": "contains",
  156. "value": [
  157. "余额不足",
  158. "insufficient",
  159. "balance",
  160. "quota",
  161. "没有开通",
  162. "权限或余额"
  163. ]
  164. },
  165. {
  166. "responseField": "mess",
  167. "operator": "contains",
  168. "value": [
  169. "余额不足",
  170. "insufficient",
  171. "balance",
  172. "quota",
  173. "没有开通",
  174. "权限或余额"
  175. ]
  176. },
  177. {
  178. "responseField": "message",
  179. "operator": "contains",
  180. "value": [
  181. "余额不足",
  182. "insufficient",
  183. "balance",
  184. "没有开通",
  185. "权限或余额"
  186. ]
  187. }
  188. ],
  189. "matchMode": "any",
  190. "trigger": "tokenConfig.onBalanceInsufficient"
  191. },
  192. "unauthorized": {
  193. "conditions": [
  194. {
  195. "responseField": "code",
  196. "operator": "in",
  197. "value": [
  198. 401,
  199. 403
  200. ]
  201. },
  202. {
  203. "responseField": "msg",
  204. "operator": "contains",
  205. "value": [
  206. "unauthorized",
  207. "token",
  208. "invalid",
  209. "auth"
  210. ]
  211. }
  212. ],
  213. "matchMode": "any",
  214. "trigger": "tokenConfig.onMissing"
  215. }
  216. }
  217. }