api-config.json 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. {
  2. "name": "review-keyword-cloud",
  3. "displayName": "评论关键词云",
  4. "description": "从评论语料生成关键词云,结合ASIN反查关键词,每个关键词带情感标签,构建VOC关键词库",
  5. "category": "review-analysis",
  6. "version": "1.3.0",
  7. "type": "orchestration",
  8. "parameters": {
  9. "reviewCorpus": {
  10. "type": "object",
  11. "required": true,
  12. "description": "review-batch-collection 输出的评论语料"
  13. },
  14. "asins": {
  15. "type": "array",
  16. "items": {
  17. "type": "string"
  18. },
  19. "required": false,
  20. "description": "ASIN列表,用于调用反查关键词补充"
  21. },
  22. "domain": {
  23. "type": "integer",
  24. "required": false,
  25. "default": 1,
  26. "description": "Amazon站点"
  27. },
  28. "topN": {
  29. "type": "integer",
  30. "required": false,
  31. "default": 50,
  32. "description": "返回Top N关键词"
  33. },
  34. "language": {
  35. "type": "string",
  36. "required": false,
  37. "default": "en",
  38. "description": "语言"
  39. }
  40. },
  41. "pipeline": [
  42. {
  43. "step": 1,
  44. "name": "评论文本分词+高频短语提取",
  45. "type": "compute",
  46. "logic": "tokenizeAndExtract(reviewCorpus)",
  47. "algorithm": {
  48. "tokenize": "分词并去除停用词",
  49. "ngrams": "提取高频单词和短语(1-gram, 2-gram, 3-gram)",
  50. "frequency": "统计词频"
  51. },
  52. "output": "reviewKeywords"
  53. },
  54. {
  55. "step": 2,
  56. "name": "ASIN反查搜索关键词",
  57. "condition": "asins && asins.length > 0",
  58. "forEach": "asins",
  59. "api": {
  60. "service": "SorftimeApiService.getAsinKeywords",
  61. "endpoint": "/api/ASINRequestKeyword",
  62. "method": "POST",
  63. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  64. "headers": {
  65. "Authorization": "Bearer {{vocToken}}"
  66. },
  67. "requestBody": {
  68. "ASIN": "${asin}"
  69. },
  70. "queryParams": {
  71. "domain": "${domain}"
  72. }
  73. },
  74. "output": "searchKeywords",
  75. "responseExtract": "Array<{ Keyword, KeywordCNName, SearchVolume, SearchRank }>"
  76. },
  77. {
  78. "step": 3,
  79. "name": "合并关键词+情感标注",
  80. "type": "compute",
  81. "logic": "mergeAndAnnotate(reviewKeywords, searchKeywords, topN)",
  82. "algorithm": {
  83. "merge": "合并评论关键词和搜索关键词",
  84. "source": "标注来源(review/search/both)",
  85. "sentiment": "基于情感词典和上下文判断 positive/negative/neutral",
  86. "weight": "按频率/搜索量/关联ASIN数加权排序",
  87. "categorize": "分类: 产品特性/使用场景/购买决策/问题反馈"
  88. },
  89. "output": "keywordCloud"
  90. }
  91. ],
  92. "response": {
  93. "type": "object",
  94. "properties": {
  95. "keywordCloud": {
  96. "type": "array",
  97. "description": "关键词云数据",
  98. "items": {
  99. "type": "object",
  100. "properties": {
  101. "keyword": {
  102. "type": "string"
  103. },
  104. "weight": {
  105. "type": "integer"
  106. },
  107. "frequency": {
  108. "type": "integer"
  109. },
  110. "source": {
  111. "type": "string",
  112. "enum": [
  113. "review",
  114. "search",
  115. "both"
  116. ]
  117. },
  118. "sentiment": {
  119. "type": "string",
  120. "enum": [
  121. "positive",
  122. "negative",
  123. "neutral"
  124. ]
  125. },
  126. "searchVolume": {
  127. "type": "integer"
  128. },
  129. "relatedAsins": {
  130. "type": "integer"
  131. }
  132. }
  133. }
  134. },
  135. "categories": {
  136. "type": "object",
  137. "description": "关键词分类",
  138. "properties": {
  139. "产品特性": {
  140. "type": "array",
  141. "items": {
  142. "type": "string"
  143. }
  144. },
  145. "使用场景": {
  146. "type": "array",
  147. "items": {
  148. "type": "string"
  149. }
  150. },
  151. "购买决策": {
  152. "type": "array",
  153. "items": {
  154. "type": "string"
  155. }
  156. },
  157. "问题反馈": {
  158. "type": "array",
  159. "items": {
  160. "type": "string"
  161. }
  162. }
  163. }
  164. },
  165. "searchKeywords": {
  166. "type": "array",
  167. "items": {
  168. "type": "object",
  169. "properties": {
  170. "keyword": {
  171. "type": "string"
  172. },
  173. "searchVolume": {
  174. "type": "integer"
  175. },
  176. "rank": {
  177. "type": "integer"
  178. }
  179. }
  180. }
  181. },
  182. "totalKeywords": {
  183. "type": "integer"
  184. },
  185. "reviewKeywordsCount": {
  186. "type": "integer"
  187. },
  188. "searchKeywordsCount": {
  189. "type": "integer"
  190. },
  191. "overlapKeywords": {
  192. "type": "integer"
  193. }
  194. }
  195. },
  196. "timeout": 300000,
  197. "retry": {
  198. "maxAttempts": 2,
  199. "delay": 2000,
  200. "backoffMultiplier": 2
  201. },
  202. "tokenConfig": {
  203. "type": "bearer",
  204. "configFile": "~/.openclaw/voc-credentials.json",
  205. "tokenField": "vocToken",
  206. "currentToken": "r:858b3ee92314d5447d1fc3cdc10462d7",
  207. "resolutionOrder": [
  208. "configFile",
  209. "currentToken"
  210. ],
  211. "apigId": "Vo3ROWEvDy",
  212. "paymentUrlResolution": {
  213. "description": "动态构建充值URL:通过当前token查出用户objectId,拼接到充值页面",
  214. "steps": [
  215. "1. 从 voc-credentials.json 或 currentToken 获取当前 session token",
  216. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  217. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  218. "4. 将该URL展示给用户,引导扫码支付"
  219. ],
  220. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  221. "userResolveHeaders": {
  222. "X-Parse-Application-Id": "ncloudmaster",
  223. "X-Parse-Session-Token": "{vocToken}"
  224. },
  225. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  226. "paymentParams": {
  227. "user": "{resolvedUserId}",
  228. "apigid": "Vo3ROWEvDy",
  229. "fun_id": "HOkkX72PMF"
  230. },
  231. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  232. },
  233. "onMissing": {
  234. "action": "resolveUserThenShowPayment",
  235. "title": "扫码开通 VOC-AI 数据服务",
  236. "message": "此 Skill 需要有效的 API Token。请按以下步骤操作:\n1. 如果你已有 Token,请告诉我,我会保存到 ~/.openclaw/voc-credentials.json\n2. 如果没有 Token,我会引导你扫码充值开通"
  237. },
  238. "onBalanceInsufficient": {
  239. "action": "resolveUserThenShowPayment",
  240. "title": "VOC-AI Token 余额不足,请扫码充值",
  241. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  242. }
  243. },
  244. "errorHandling": {
  245. "balanceInsufficient": {
  246. "conditions": [
  247. {
  248. "responseField": "code",
  249. "operator": "in",
  250. "value": [
  251. -2,
  252. -3,
  253. -10,
  254. 402,
  255. 429
  256. ]
  257. },
  258. {
  259. "responseField": "msg",
  260. "operator": "contains",
  261. "value": [
  262. "余额不足",
  263. "insufficient",
  264. "balance",
  265. "quota"
  266. ]
  267. },
  268. {
  269. "responseField": "message",
  270. "operator": "contains",
  271. "value": [
  272. "余额不足",
  273. "insufficient",
  274. "balance"
  275. ]
  276. }
  277. ],
  278. "matchMode": "any",
  279. "trigger": "tokenConfig.onBalanceInsufficient"
  280. },
  281. "unauthorized": {
  282. "conditions": [
  283. {
  284. "responseField": "code",
  285. "operator": "in",
  286. "value": [
  287. 401,
  288. 403
  289. ]
  290. },
  291. {
  292. "responseField": "msg",
  293. "operator": "contains",
  294. "value": [
  295. "unauthorized",
  296. "token",
  297. "invalid",
  298. "auth"
  299. ]
  300. }
  301. ],
  302. "matchMode": "any",
  303. "trigger": "tokenConfig.onMissing"
  304. }
  305. }
  306. }