api-config.json 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. {
  2. "name": "review-batch-collection",
  3. "displayName": "评论批量采集",
  4. "description": "对多个ASIN批量采集Amazon评论,支持翻页和星级过滤,输出结构化评论语料库",
  5. "category": "review-analysis",
  6. "version": "1.3.0",
  7. "type": "orchestration",
  8. "parameters": {
  9. "asins": {
  10. "type": "array",
  11. "items": { "type": "string" },
  12. "required": true,
  13. "description": "ASIN列表"
  14. },
  15. "maxPagesPerAsin": {
  16. "type": "integer",
  17. "required": false,
  18. "default": 5,
  19. "description": "每个ASIN最大翻页数"
  20. },
  21. "starFilter": {
  22. "type": "array",
  23. "items": { "type": "integer", "enum": [1, 2, 3, 4, 5] },
  24. "required": false,
  25. "description": "星级过滤,不传则全部"
  26. },
  27. "onlyVerifiedPurchase": {
  28. "type": "boolean",
  29. "required": false,
  30. "default": false,
  31. "description": "只采集已验证购买"
  32. },
  33. "domain": {
  34. "type": "integer",
  35. "required": false,
  36. "default": 1,
  37. "description": "Amazon站点"
  38. }
  39. },
  40. "pipeline": [
  41. {
  42. "step": 1,
  43. "name": "批量ASIN×多页评论采集",
  44. "forEach": "asins × [1..maxPagesPerAsin] × (starFilter || [null])",
  45. "api": {
  46. "service": "SorftimeApiService.getProductReviews",
  47. "endpoint": "/api/ProductReviewsQuery",
  48. "method": "POST",
  49. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  50. "headers": { "Authorization": "Bearer r:858b3ee92314d5447d1fc3cdc10462d7" },
  51. "requestBody": {
  52. "ASIN": "${asin}",
  53. "Star": "${star || ''}",
  54. "PageIndex": "${pageIndex}",
  55. "OnlyPurchase": "${onlyVerifiedPurchase ? 1 : 0}",
  56. "QueryStartDt": ""
  57. },
  58. "queryParams": { "domain": "${domain}" },
  59. "rateLimit": "400ms between requests per ASIN"
  60. },
  61. "output": "rawReviews",
  62. "responseFields": {
  63. "note": "Sorftime返回的评论字段为PascalCase",
  64. "Star": "integer, 1-5",
  65. "Title": "string, 评论标题",
  66. "Content": "string, 评论正文",
  67. "ConsumerName": "string",
  68. "ConsumerURL": "string, 用户主页链接",
  69. "ReviewsDate": "string, 格式'20260204'",
  70. "ReviewedCountry": "string, 如'United States'",
  71. "IsVP": "boolean, 已验证购买",
  72. "Helpful": "integer",
  73. "ReviewsLink": "string, 评论链接",
  74. "Asin": "string",
  75. "AsinProperty": "string, 变体属性",
  76. "Resource": "array, 图片",
  77. "Videos": "array"
  78. },
  79. "pagination": "多页采集时每页请求间隔400ms避免限流,PageIndex从1开始递增直到无更多数据"
  80. },
  81. {
  82. "step": 2,
  83. "name": "去重+清洗",
  84. "type": "compute",
  85. "logic": "deduplicateAndClean(rawReviews)",
  86. "algorithm": {
  87. "deduplicate": "按ReviewsLink去重",
  88. "clean": "过滤Content长度<10的无效短评论",
  89. "normalize": "统一字段名为cabmelCase: Star→star, Content→content, ReviewsDate→reviewDate"
  90. },
  91. "output": "cleanedReviews"
  92. },
  93. {
  94. "step": 3,
  95. "name": "统计汇总",
  96. "type": "compute",
  97. "logic": "computeStats(cleanedReviews)",
  98. "algorithm": {
  99. "perAsin": "{ total, avgRating, positiveRate(4-5★%), negativeRate(1-2★%), neutralRate(3★%) }",
  100. "overall": "{ totalReviews, asinsCollected, avgStarDistribution }",
  101. "starDistribution": "统计各星级评论数: groupBy(star) → {1:n,2:n,3:n,4:n,5:n}"
  102. },
  103. "output": "stats"
  104. },
  105. {
  106. "step": 4,
  107. "name": "竞品VOC对比汇总",
  108. "type": "compute",
  109. "logic": "computeCompetitorVocComparison(cleanedReviews, asins, { ownAsins })",
  110. "algorithm": {
  111. "grouping": "将ASIN分为本店(ownAsins)和竞品两组",
  112. "perGroup": {
  113. "count": "产品数",
  114. "avgRating": "加权平均评分 = sum(rating*ratingsCount)/sum(ratingsCount)",
  115. "totalReviews": "总评论数",
  116. "negativeRate": "差评率 = avg(1★%+2★%) per product",
  117. "topProducts": "按ratingsCount降序取top5产品: { asin, title(40字), rating, ratingsCount, negativeRate }"
  118. },
  119. "starPctFields": "星级百分比字段: oneStartRatings/twoStartRatings/threeStartRatings/fourStartRatings/fiveStartRatings",
  120. "ratingCalc": "rawRating>0用rawRating; 否则starSum>0时(1*one+2*two+3*three+4*four+5*five)/starSum"
  121. },
  122. "output": "vocComparison"
  123. }
  124. ],
  125. "response": {
  126. "type": "object",
  127. "properties": {
  128. "reviews": {
  129. "type": "array",
  130. "description": "清洗后的评论列表",
  131. "items": {
  132. "type": "object",
  133. "properties": {
  134. "asin": { "type": "string" },
  135. "star": { "type": "integer", "description": "1-5" },
  136. "title": { "type": "string" },
  137. "content": { "type": "string" },
  138. "consumerName": { "type": "string" },
  139. "reviewDate": { "type": "string", "description": "原始ReviewsDate格式20260204" },
  140. "isVerifiedPurchase": { "type": "boolean", "description": "原始IsVP" },
  141. "helpful": { "type": "integer" },
  142. "reviewLink": { "type": "string", "description": "原始ReviewsLink" },
  143. "variant": { "type": "string", "description": "原始AsinProperty" },
  144. "country": { "type": "string", "description": "原始ReviewedCountry" }
  145. }
  146. }
  147. },
  148. "stats": {
  149. "type": "object",
  150. "description": "采集统计概况",
  151. "properties": {
  152. "totalReviews": { "type": "integer" },
  153. "asinsCollected": { "type": "integer" },
  154. "avgRating": { "type": "number" },
  155. "positiveRate": { "type": "number" },
  156. "negativeRate": { "type": "number" },
  157. "perAsinStats": { "type": "object" }
  158. }
  159. },
  160. "vocComparison": {
  161. "type": "object",
  162. "description": "本店vs竞品VOC对比",
  163. "properties": {
  164. "own": {
  165. "type": "object",
  166. "properties": {
  167. "count": { "type": "integer" },
  168. "avgRating": { "type": "number" },
  169. "totalReviews": { "type": "integer" },
  170. "negativeRate": { "type": "number" },
  171. "products": { "type": "array", "items": { "type": "object", "properties": { "asin": {"type":"string"}, "title": {"type":"string"}, "rating": {"type":"number"}, "ratingsCount": {"type":"integer"}, "negativeRate": {"type":"number"} } } }
  172. }
  173. },
  174. "competitor": {
  175. "type": "object",
  176. "properties": {
  177. "count": { "type": "integer" },
  178. "avgRating": { "type": "number" },
  179. "totalReviews": { "type": "integer" },
  180. "negativeRate": { "type": "number" },
  181. "products": { "type": "array", "items": { "type": "object", "properties": { "asin": {"type":"string"}, "title": {"type":"string"}, "rating": {"type":"number"}, "ratingsCount": {"type":"integer"}, "negativeRate": {"type":"number"} } } }
  182. }
  183. }
  184. }
  185. }
  186. }
  187. },
  188. "timeout": 300000,
  189. "retry": {
  190. "maxAttempts": 3,
  191. "delay": 2000,
  192. "backoffMultiplier": 2
  193. }
  194. }