api-config.json 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. {
  2. "name": "social-trend-analysis",
  3. "displayName": "社媒趋势与热度分析",
  4. "description": "综合TikTok和Instagram数据,分析品类社媒趋势、热度走向和内容生态",
  5. "category": "social-voc",
  6. "version": "1.3.0",
  7. "type": "analysis",
  8. "parameters": {
  9. "tiktokCategoryVoc": {
  10. "type": "object",
  11. "required": true,
  12. "description": "tiktok-category-voc 输出数据"
  13. },
  14. "tiktokBrandVoc": {
  15. "type": "object",
  16. "required": true,
  17. "description": "tiktok-brand-voc 输出数据"
  18. },
  19. "instagramBrandVoc": {
  20. "type": "object",
  21. "required": true,
  22. "description": "instagram-brand-voc 输出数据"
  23. },
  24. "categoryKeyword": {
  25. "type": "string",
  26. "required": true,
  27. "description": "品类关键词"
  28. }
  29. },
  30. "pipeline": [
  31. {
  32. "step": 1,
  33. "name": "跨平台热度对比",
  34. "type": "compute",
  35. "logic": "comparePlatforms(tiktokCategoryVoc, instagramBrandVoc)",
  36. "algorithm": {
  37. "tiktokHeat": "totalPlayCount + avgEngagementRate + hashtagViewCount",
  38. "instagramHeat": "totalFollowers + avgEngagementRate + avgLikeCount",
  39. "comparison": "对比两个平台的品类热度/互动质量/内容形式偏好"
  40. },
  41. "output": "platformComparison"
  42. },
  43. {
  44. "step": 2,
  45. "name": "趋势话题识别",
  46. "type": "compute",
  47. "logic": "identifyTrends(tiktokCategoryVoc, tiktokBrandVoc, instagramBrandVoc)",
  48. "algorithm": {
  49. "topicMerge": "合并TikTok视频desc高频词 + IG帖子caption高频hashtag",
  50. "trendScore": "trendScore = viewCount*0.3 + engagementRate*0.3 + recentGrowth*0.4",
  51. "classify": "分类为: 产品趋势/使用场景/内容形式/季节性热点"
  52. },
  53. "output": "trends"
  54. },
  55. {
  56. "step": 3,
  57. "name": "品牌社媒综合排名",
  58. "type": "compute",
  59. "logic": "rankBrandSocial(tiktokBrandVoc, instagramBrandVoc)",
  60. "algorithm": {
  61. "socialScore": "socialScore = tkFollowers*0.2 + tkEngagement*0.2 + igFollowers*0.2 + igEngagement*0.2 + postFrequency*0.1 + contentQuality*0.1",
  62. "ranking": "按socialScore降序排名",
  63. "insights": "每个品牌的社媒策略特点: TikTok偏重型/IG偏重型/双平台均衡型"
  64. },
  65. "output": "brandRanking"
  66. },
  67. {
  68. "step": 4,
  69. "name": "内容机会发现",
  70. "type": "compute",
  71. "logic": "findContentOpportunities(tiktokCategoryVoc, instagramBrandVoc)",
  72. "algorithm": {
  73. "gapAnalysis": "品类热门话题 vs 品牌已覆盖话题 → 发现未覆盖热点",
  74. "formatGap": "当前品类爆款内容形式 vs 品牌已采用形式",
  75. "timingOpportunity": "热门发布时间 vs 品牌当前发布时间"
  76. },
  77. "output": "opportunities"
  78. },
  79. {
  80. "step": 5,
  81. "name": "优先级行动清单",
  82. "type": "compute",
  83. "logic": "computeActions(platformComparison, trends, brandRanking, opportunities)",
  84. "algorithm": {
  85. "priorityRules": [
  86. {
  87. "priority": "highest",
  88. "condition": "未覆盖热门话题存在",
  89. "action": "立即跟进未覆盖话题,发布相关内容",
  90. "deadline": "3天内"
  91. },
  92. {
  93. "priority": "high",
  94. "condition": "互动率低于品类平均",
  95. "action": "优化内容形式,参考品类爆款视频结构",
  96. "deadline": "7天内"
  97. },
  98. {
  99. "priority": "high",
  100. "condition": "发布频率低于竞品",
  101. "action": "提升发布频率至竞品平均水平",
  102. "deadline": "7天内"
  103. },
  104. {
  105. "priority": "medium",
  106. "condition": "双平台不均衡",
  107. "action": "在弱势平台增加内容布局",
  108. "deadline": "15天内"
  109. },
  110. {
  111. "priority": "medium",
  112. "condition": "always",
  113. "action": "建立KOL合作清单,筛选高互动率中腰部达人",
  114. "deadline": "15天内"
  115. }
  116. ]
  117. },
  118. "output": "actionItems"
  119. }
  120. ],
  121. "response": {
  122. "type": "object",
  123. "properties": {
  124. "platformComparison": {
  125. "type": "object",
  126. "description": "平台热度对比",
  127. "properties": {
  128. "tiktok": {
  129. "type": "object",
  130. "properties": {
  131. "totalPlays": {
  132. "type": "integer"
  133. },
  134. "avgEngagement": {
  135. "type": "number"
  136. }
  137. }
  138. },
  139. "instagram": {
  140. "type": "object",
  141. "properties": {
  142. "totalFollowers": {
  143. "type": "integer"
  144. },
  145. "avgEngagement": {
  146. "type": "number"
  147. }
  148. }
  149. },
  150. "dominantPlatform": {
  151. "type": "string"
  152. },
  153. "insight": {
  154. "type": "string"
  155. }
  156. }
  157. },
  158. "trendingTopics": {
  159. "type": "array",
  160. "description": "趋势话题列表",
  161. "items": {
  162. "type": "object",
  163. "properties": {
  164. "topic": {
  165. "type": "string"
  166. },
  167. "trendScore": {
  168. "type": "number"
  169. },
  170. "category": {
  171. "type": "string"
  172. },
  173. "platforms": {
  174. "type": "array"
  175. }
  176. }
  177. }
  178. },
  179. "brandSocialRanking": {
  180. "type": "array",
  181. "description": "品牌社媒排名",
  182. "items": {
  183. "type": "object",
  184. "properties": {
  185. "brand": {
  186. "type": "string"
  187. },
  188. "socialScore": {
  189. "type": "number"
  190. },
  191. "strategyType": {
  192. "type": "string"
  193. }
  194. }
  195. }
  196. },
  197. "contentOpportunities": {
  198. "type": "array",
  199. "description": "内容机会点",
  200. "items": {
  201. "type": "object",
  202. "properties": {
  203. "opportunity": {
  204. "type": "string"
  205. },
  206. "platform": {
  207. "type": "string"
  208. },
  209. "priority": {
  210. "type": "string",
  211. "enum": [
  212. "high",
  213. "medium",
  214. "low"
  215. ]
  216. }
  217. }
  218. }
  219. },
  220. "audienceInsights": {
  221. "type": "object",
  222. "description": "受众洞察",
  223. "properties": {
  224. "topCommentThemes": {
  225. "type": "array"
  226. },
  227. "sentimentDistribution": {
  228. "type": "object"
  229. },
  230. "engagementPatterns": {
  231. "type": "object"
  232. }
  233. }
  234. },
  235. "actionItems": {
  236. "type": "array",
  237. "description": "优先级行动清单",
  238. "items": {
  239. "type": "object",
  240. "properties": {
  241. "priority": {
  242. "type": "string",
  243. "enum": [
  244. "highest",
  245. "high",
  246. "medium",
  247. "low"
  248. ]
  249. },
  250. "action": {
  251. "type": "string"
  252. },
  253. "deadline": {
  254. "type": "string"
  255. },
  256. "expectedResult": {
  257. "type": "string"
  258. }
  259. }
  260. }
  261. }
  262. }
  263. },
  264. "timeout": 120000,
  265. "retry": {
  266. "maxAttempts": 2,
  267. "delay": 1000,
  268. "backoffMultiplier": 2
  269. },
  270. "tokenConfig": {
  271. "type": "bearer",
  272. "configFile": "~/.openclaw/voc-credentials.json",
  273. "tokenField": "vocToken",
  274. "resolutionOrder": [
  275. "configFile"
  276. ],
  277. "apigId": "Vo3ROWEvDy",
  278. "paymentUrlResolution": {
  279. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  280. "steps": [
  281. "1. 从 voc-credentials.json 获取当前 session token",
  282. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  283. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  284. "4. 将该URL展示给用户,引导扫码支付"
  285. ],
  286. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  287. "userResolveHeaders": {
  288. "X-Parse-Application-Id": "ncloudmaster",
  289. "X-Parse-Session-Token": "{vocToken}"
  290. },
  291. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  292. "paymentParams": {
  293. "user": "{resolvedUserId}",
  294. "apigid": "Vo3ROWEvDy",
  295. "fun_id": "HOkkX72PMF"
  296. },
  297. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  298. },
  299. "onMissing": {
  300. "action": "showPaymentQR",
  301. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=Vo3ROWEvDy&fun_id=HOkkX72PMF",
  302. "title": "扫码开通 VOC-AI 数据服务",
  303. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  304. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  305. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  306. },
  307. "onBalanceInsufficient": {
  308. "action": "resolveUserThenShowPayment",
  309. "title": "VOC-AI Token 余额不足,请扫码充值",
  310. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  311. }
  312. },
  313. "errorHandling": {
  314. "balanceInsufficient": {
  315. "conditions": [
  316. {
  317. "responseField": "code",
  318. "operator": "in",
  319. "value": [
  320. -2,
  321. -3,
  322. -10,
  323. 402,
  324. 429
  325. ]
  326. },
  327. {
  328. "responseField": "msg",
  329. "operator": "contains",
  330. "value": [
  331. "余额不足",
  332. "insufficient",
  333. "balance",
  334. "quota",
  335. "没有开通",
  336. "权限或余额"
  337. ]
  338. },
  339. {
  340. "responseField": "mess",
  341. "operator": "contains",
  342. "value": [
  343. "余额不足",
  344. "insufficient",
  345. "balance",
  346. "quota",
  347. "没有开通",
  348. "权限或余额"
  349. ]
  350. },
  351. {
  352. "responseField": "message",
  353. "operator": "contains",
  354. "value": [
  355. "余额不足",
  356. "insufficient",
  357. "balance",
  358. "没有开通",
  359. "权限或余额"
  360. ]
  361. }
  362. ],
  363. "matchMode": "any",
  364. "trigger": "tokenConfig.onBalanceInsufficient"
  365. },
  366. "unauthorized": {
  367. "conditions": [
  368. {
  369. "responseField": "code",
  370. "operator": "in",
  371. "value": [
  372. 401,
  373. 403
  374. ]
  375. },
  376. {
  377. "responseField": "msg",
  378. "operator": "contains",
  379. "value": [
  380. "unauthorized",
  381. "token",
  382. "invalid",
  383. "auth"
  384. ]
  385. }
  386. ],
  387. "matchMode": "any",
  388. "trigger": "tokenConfig.onMissing"
  389. }
  390. }
  391. }