api-config.json 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765
  1. {
  2. "name": "product-deep-analysis",
  3. "displayName": "单品深度诊断",
  4. "description": "针对单个ASIN进行多维度深度分析:流量架构透视、定价策略、Listing优化、VOC痛点、广告策略、市场机会,并由AI生成核心诊断和运营建议",
  5. "version": "1.3.0",
  6. "category": "synthesis",
  7. "parameters": {
  8. "asin": {
  9. "type": "string",
  10. "required": true,
  11. "description": "目标ASIN"
  12. },
  13. "domain": {
  14. "type": "integer",
  15. "default": 1,
  16. "description": "Amazon站点: 1=US, 2=UK, 3=DE, 4=FR, 5=JP, 6=CA, 7=IT, 8=ES"
  17. },
  18. "includeReviews": {
  19. "type": "boolean",
  20. "default": true,
  21. "description": "是否采集评论用于VOC分析"
  22. },
  23. "reviewPages": {
  24. "type": "integer",
  25. "default": 3,
  26. "description": "评论采集页数(每页10条)"
  27. },
  28. "competitorAsins": {
  29. "type": "array",
  30. "items": {
  31. "type": "string"
  32. },
  33. "default": [],
  34. "description": "可选的竞品ASIN列表,用于对比分析"
  35. }
  36. },
  37. "pipeline": [
  38. {
  39. "step": 1,
  40. "name": "获取产品详情",
  41. "api": {
  42. "endpoint": "/api/ProductRequest",
  43. "method": "POST",
  44. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  45. "headers": {
  46. "Authorization": "Bearer {{vocToken}}"
  47. },
  48. "requestBody": {
  49. "ASIN": "${asin}",
  50. "Trend": 1,
  51. "QueryTrendStartDt": "",
  52. "QueryTrendEndDt": ""
  53. },
  54. "queryParams": {
  55. "domain": "${domain}"
  56. }
  57. },
  58. "output": "productDetail",
  59. "responseExtract": {
  60. "title": "Title",
  61. "brand": "Brand",
  62. "salesPrice": "SalesPrice (cents, /100→USD)",
  63. "ratings": "Ratings",
  64. "starDistribution": "{ fiveStartRatings, fourStartRatings, threeStartRatings, twoStartRatings, oneStartRatings } (百分比值)",
  65. "monthlySales": "ListingSalesVolumeOfMonthTrend (数组, 末值=最新月销)",
  66. "bsr": "BsrRank",
  67. "category": "Category (数组)",
  68. "feature": "Feature",
  69. "photo": "Photo (数组)",
  70. "variationASIN": "VariationASIN (数组)",
  71. "priceTrend": "PriceTrend (数组[date,cents,...])",
  72. "rankTrend": "RankTrend (数组[date,rank,...])",
  73. "salesTrend": "ListingSalesVolumeOfMonthTrend (数组[date,vol,...])"
  74. }
  75. },
  76. {
  77. "step": 2,
  78. "name": "ASIN反查关键词",
  79. "api": {
  80. "endpoint": "/api/ASINRequestKeyword",
  81. "method": "POST",
  82. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  83. "headers": {
  84. "Authorization": "Bearer {{vocToken}}"
  85. },
  86. "requestBody": {
  87. "ASIN": "${asin}"
  88. },
  89. "queryParams": {
  90. "domain": "${domain}"
  91. }
  92. },
  93. "output": "asinKeywords",
  94. "responseExtract": "Array<{ Keyword, KeywordCNName, SearchVolume, SearchRank, SPR, TitleDensity, ProductCount, ShareClickRate, ShareConversionRate, CPC, GrowthRate, Season, Top3Brand, Top3Asin, WordCount }>"
  95. },
  96. {
  97. "step": 3,
  98. "name": "获取监控数据(价格/排名趋势)",
  99. "api": {
  100. "endpoint": "/api/MonitorQuery",
  101. "method": "POST",
  102. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  103. "headers": {
  104. "Authorization": "Bearer {{vocToken}}"
  105. },
  106. "requestBody": {
  107. "ASIN": "${asin}"
  108. },
  109. "queryParams": {
  110. "domain": "${domain}"
  111. }
  112. },
  113. "output": "monitorData",
  114. "responseExtract": "{ PriceHistory, RankHistory, RatingHistory, ReviewCountHistory, SellerCount }"
  115. },
  116. {
  117. "step": 4,
  118. "name": "采集评论(可选)",
  119. "condition": "includeReviews == true",
  120. "loop": {
  121. "from": 1,
  122. "to": "${reviewPages}",
  123. "var": "pageIndex",
  124. "delay": 400
  125. },
  126. "api": {
  127. "endpoint": "/api/ProductReviewsQuery",
  128. "method": "POST",
  129. "forwardUrl": "https://server.fmode.cn/api/voc-ecom/forward",
  130. "headers": {
  131. "Authorization": "Bearer {{vocToken}}"
  132. },
  133. "requestBody": {
  134. "ASIN": "${asin}",
  135. "PageIndex": "${pageIndex}"
  136. },
  137. "queryParams": {
  138. "domain": "${domain}"
  139. }
  140. },
  141. "output": "reviews",
  142. "responseExtract": "Array<{ Star, Title, Content, ReviewsDate, ReviewedCountry, IsVP, Helpful, ConsumerName, Asin, AsinProperty }>"
  143. },
  144. {
  145. "step": 5,
  146. "name": "流量架构分析(关键词维度)",
  147. "type": "compute",
  148. "logic": "analyzeKeywordTraffic(asinKeywords, productDetail)",
  149. "algorithm": {
  150. "competitionLevel": {
  151. "high": "ProductCount > 50000 或 CPC > $2.00",
  152. "medium": "ProductCount > 10000 或 CPC > $1.00",
  153. "low": "其余"
  154. },
  155. "valueScore": {
  156. "formula": "min(100, searchVolumeScore + growthScore + conversionScore + competitionReverse)",
  157. "searchVolume_30pts": ">100K→30, >10K→20, >1K→10, else→5",
  158. "growth_25pts": ">50%→25, >20%→20, >0%→10, ≤0%→0",
  159. "conversion_25pts": "ShareConversionRate >5%→25, >2%→15, >0%→5, else→0",
  160. "competitionReverse_20pts": "low→20, medium→10, high→0"
  161. },
  162. "trafficShare": "按SearchVolume计算各关键词的流量占比百分比",
  163. "diagnosis": {
  164. "perKeyword": "根据自然排名(SearchRank)、广告占比(CPC/竞争度)、转化效率(ShareConversionRate/ShareClickRate)生成诊断文本",
  165. "naturalVsAd": "自然排名<=#10→主要自然流量; 仅广告位→依赖广告; 混合→广告+自然",
  166. "conversionEfficiency": "ShareConversionRate/ShareClickRate >1.5→转化效率极高; <0.5→转化偏低需优化Listing"
  167. },
  168. "keywordClassification": {
  169. "core": "matchScore>=70 且 valueScore>=60",
  170. "secondary": "matchScore>=50 或 valueScore>=50",
  171. "longtail": "其余"
  172. }
  173. },
  174. "output": "keywordAnalysis"
  175. },
  176. {
  177. "step": 6,
  178. "name": "定价策略分析",
  179. "type": "compute",
  180. "logic": "analyzePricing(productDetail, competitorAsins)",
  181. "algorithm": {
  182. "priceBands": {
  183. "method": "按五分位划分价格带: 低价带(<P20)/中低价带(P20-P40)/黄金中价带(P40-P60)/中高价带(P60-P80)/高价带(>P80)",
  184. "perBand": "每个价格带计算: skuCount, pct(SKU占比), avgSales, avgRating, avgBsr",
  185. "goldenBandScoring": "bandScore = avgSales*0.5 + avgRating*20 + (skuCount>0?10:0), 最高分为黄金带",
  186. "isGolden": "标记量利平衡最优带"
  187. },
  188. "optimalPrice": {
  189. "formula": "goldenBandMin + (goldenBandMax-goldenBandMin)*0.6 * min(1.15, max(0.85, selfRating/bandAvgRating))",
  190. "range": "最优价格 ±5%"
  191. },
  192. "marginEstimate": {
  193. "commission": "15% Amazon佣金",
  194. "fba": "$5 FBA费用",
  195. "cogs": "30% 采购成本估算",
  196. "formula": "grossMargin = (price*(1-0.15) - 5 - price*0.30) / price * 100",
  197. "breakEvenSales": "avgSales * (currentMargin/suggestedMargin) * 0.85"
  198. },
  199. "positionStrategy": {
  200. "below": "评分高于带均值→提价获溢价; 否则→逐步调至带内",
  201. "within": "维持价格,优化Listing提升转化率",
  202. "above": "评分>=4.5→维持高价品牌定位; 否则→降至最优价附近"
  203. },
  204. "promotionAdvice": {
  205. "priceWarRisk": "价格带高度集中(spread<avgPrice*0.3)时不建议降价,优先「多件折扣」「满减策略」",
  206. "bundleDiscount": "2件9折/3件8折套装折扣,提升连带率"
  207. }
  208. },
  209. "output": "pricingAnalysis"
  210. },
  211. {
  212. "step": 7,
  213. "name": "Listing优化评估",
  214. "type": "compute",
  215. "logic": "evaluateListing(productDetail, keywordAnalysis)",
  216. "algorithm": {
  217. "dimensions": {
  218. "title": {
  219. "scoring": "基础40 + 评分>=4.0(+10) + 月销>100(+10) + 有核心词(+5), 上限75",
  220. "tips": "核心词放前65字符(移动端截断); 多词关键词核心词靠前; 高搜索量>50K作核心词, <5K作长尾"
  221. },
  222. "bullet": {
  223. "tips": "第1-2条融入核心词; 围绕搜索意图突出卖点; 竞品品牌占据的词需差异化; 旺季前强调季节卖点"
  224. },
  225. "searchTerm": {
  226. "tips": "填入变体和同义词; 避免重复标题已有词; 短词补长尾变体, 长尾补拆分短词"
  227. },
  228. "image": {
  229. "tips": "主图白底高清>=2000px; 场景图展示核心卖点; 信息图标注差异化特征; >=7张图+1视频"
  230. },
  231. "aPlus": {
  232. "tips": "品牌故事强化认知; 对比表格突出vs竞品优势; 场景图呼应关键词意图; 好评截图增强信任"
  233. }
  234. }
  235. },
  236. "output": "listingAnalysis"
  237. },
  238. {
  239. "step": 8,
  240. "name": "VOC痛点提取",
  241. "condition": "includeReviews == true && reviews.length > 0",
  242. "type": "compute",
  243. "logic": "extractPainPoints(reviews)",
  244. "algorithm": {
  245. "filter": "star<=2的差评",
  246. "tokenize": "split+toLowerCase, 过滤停用词(200+常见英文词/购物泛词/情感泛词), 最小词长>=5",
  247. "bigram": "提取相邻双词组合(如'broke easily','fell apart','poor quality')",
  248. "frequency": "按评论去重计频(每条评论每个词/短语最多计1次), 过滤出现>=2次的",
  249. "ranking": "bigram优先, 同类按频率降序, 取top8",
  250. "severity": "severity = min(100, freq/totalNeg*100*0.4 + rankBonus*0.3 + 30*0.3)",
  251. "impact": "severity>=70→high, >=40→medium, <40→low"
  252. },
  253. "output": "vocPainPoints"
  254. },
  255. {
  256. "step": 9,
  257. "name": "广告策略推荐",
  258. "type": "compute",
  259. "logic": "recommendAdStrategy(keywordAnalysis, productDetail)",
  260. "algorithm": {
  261. "bidSuggestion": {
  262. "formula": "suggestedBid = CPC * bidMultiplier",
  263. "multiplier": "valueScore>=70→1.2, >=40→1.0, <40→0.8"
  264. },
  265. "expectedAcos": "suggestedBid / (avgPrice * conversionRate) * 100",
  266. "matchType": {
  267. "high_competition": "精准匹配 - 先自动广告测试转化",
  268. "medium_competition": "短语+精准组合",
  269. "low_competition": "广泛匹配 - 抢流量积销量"
  270. },
  271. "dailyBudget": "valueScore>=70→$50, >=40→$30, <40→$15",
  272. "extraRules": {
  273. "growthOver30pct": "提前布局广告占位",
  274. "convClickRatioOver1_5": "转化效率极高,加大投放",
  275. "convClickRatioUnder0_5": "先优化Listing转化率再重点投放"
  276. }
  277. },
  278. "output": "adStrategy"
  279. },
  280. {
  281. "step": 10,
  282. "name": "综合健康评分",
  283. "type": "compute",
  284. "logic": "calcOverallScore(keywordAnalysis, pricingAnalysis, productDetail, reviews)",
  285. "algorithm": {
  286. "baseScore": 50,
  287. "keywordBonus_20": "核心词数*5, 上限20",
  288. "pricingBonus_20": "在最优带内→+20, 偏低→+10, 偏高→+5",
  289. "ratingBonus_15": ">=4.5→+15, >=4.0→+10, >=3.5→+5",
  290. "reviewBonus_10": ">100条→+10, >30条→+5",
  291. "cap": 100,
  292. "verdict": {
  293. "strong": ">=80分: 产品综合竞争力强",
  294. "potential": ">=60分: 产品有提升空间",
  295. "needFix": "<60分: 产品需要重点优化"
  296. }
  297. },
  298. "output": "overallScore"
  299. },
  300. {
  301. "step": 11,
  302. "name": "AI生成核心诊断与运营建议",
  303. "type": "ai",
  304. "logic": "generateDiagnosis(overallScore, keywordAnalysis, pricingAnalysis, listingAnalysis, vocPainPoints, adStrategy, productDetail, monitorData)",
  305. "aiConfig": {
  306. "systemPrompt": "你是一名资深的亚马逊跨境电商运营专家,精通选品、Listing优化、关键词策略、定价策略和广告投放。请基于提供的算法分析结果和数据,给出深度专业的中文建议,使用Markdown格式输出。你的建议应该:具体可执行、有数据支撑、考虑ROI、分优先级排序。",
  307. "userPromptTemplate": "# 智能推荐分析请求\n综合健康分:${overallScore}/100\n目标ASIN:${asin}\n品类:${category}\n当前价格:$${currentPrice}\n当前评分:${currentRating}\n当前月销:${currentMonthlySales}\n\n## 关键词分析结果\n${keywordSummary}\n\n## 定价分析结果\n${pricingSummary}\n\n## VOC痛点分析\n${vocSummary}\n\n## 请基于以上算法分析结果,输出以下内容:\n1. **核心诊断** — 当前产品的核心优势和瓶颈(季节性/功能性/流量结构)\n2. **流量架构透视** — 关键词表格(关键词/流量占比/月搜索量/竞争分析诊断)\n3. **运营建议(Action Plan)** — 广告策略PPC/Listing优化SEO&CRO/备货节奏\n4. **30天行动计划** — 按周排列的可执行任务清单",
  308. "outputFormat": "Markdown格式,包含核心诊断/流量架构透视表格/运营建议(PPC+Listing+备货)/行动计划",
  309. "temperature": 0.5,
  310. "maxTokens": 8000,
  311. "promptPattern": "system约束专家角色+Markdown输出 + user注入算法结果摘要 + 指定输出章节结构"
  312. },
  313. "output": "aiDiagnosis"
  314. }
  315. ],
  316. "response": {
  317. "type": "object",
  318. "properties": {
  319. "productSummary": {
  320. "type": "object",
  321. "description": "产品基本信息摘要",
  322. "properties": {
  323. "asin": {
  324. "type": "string"
  325. },
  326. "title": {
  327. "type": "string"
  328. },
  329. "brand": {
  330. "type": "string"
  331. },
  332. "price": {
  333. "type": "number",
  334. "description": "美元"
  335. },
  336. "rating": {
  337. "type": "number"
  338. },
  339. "monthlySales": {
  340. "type": "integer"
  341. },
  342. "bsr": {
  343. "type": "integer"
  344. },
  345. "category": {
  346. "type": "string"
  347. }
  348. }
  349. },
  350. "overallScore": {
  351. "type": "object",
  352. "description": "综合健康评分",
  353. "properties": {
  354. "score": {
  355. "type": "integer",
  356. "description": "0-100"
  357. },
  358. "verdict": {
  359. "type": "string"
  360. },
  361. "breakdown": {
  362. "type": "object",
  363. "properties": {
  364. "keyword": {
  365. "type": "integer"
  366. },
  367. "pricing": {
  368. "type": "integer"
  369. },
  370. "rating": {
  371. "type": "integer"
  372. },
  373. "review": {
  374. "type": "integer"
  375. }
  376. }
  377. }
  378. }
  379. },
  380. "keywordAnalysis": {
  381. "type": "object",
  382. "description": "流量架构透视",
  383. "properties": {
  384. "topKeywords": {
  385. "type": "array",
  386. "description": "关键词流量表",
  387. "items": {
  388. "type": "object",
  389. "properties": {
  390. "keyword": {
  391. "type": "string"
  392. },
  393. "keywordCN": {
  394. "type": "string"
  395. },
  396. "trafficShare": {
  397. "type": "number",
  398. "description": "流量占比%"
  399. },
  400. "searchVolume": {
  401. "type": "integer",
  402. "description": "月搜索量"
  403. },
  404. "searchRank": {
  405. "type": "integer",
  406. "description": "自然排名"
  407. },
  408. "competitionLevel": {
  409. "type": "string",
  410. "enum": [
  411. "low",
  412. "medium",
  413. "high"
  414. ]
  415. },
  416. "valueScore": {
  417. "type": "integer",
  418. "description": "0-100"
  419. },
  420. "diagnosis": {
  421. "type": "string",
  422. "description": "竞争分析诊断文本"
  423. },
  424. "priority": {
  425. "type": "string",
  426. "enum": [
  427. "core",
  428. "secondary",
  429. "longtail"
  430. ]
  431. }
  432. }
  433. }
  434. },
  435. "trafficStructure": {
  436. "type": "object",
  437. "description": "流量结构摘要",
  438. "properties": {
  439. "organicPct": {
  440. "type": "number",
  441. "description": "自然流量占比"
  442. },
  443. "adPct": {
  444. "type": "number",
  445. "description": "广告流量占比"
  446. },
  447. "topKeywordConcentration": {
  448. "type": "number",
  449. "description": "Top5关键词流量集中度"
  450. }
  451. }
  452. }
  453. }
  454. },
  455. "pricingAnalysis": {
  456. "type": "object",
  457. "description": "定价策略分析",
  458. "properties": {
  459. "currentPrice": {
  460. "type": "number"
  461. },
  462. "optimalPrice": {
  463. "type": "number"
  464. },
  465. "recommendedRange": {
  466. "type": "object",
  467. "properties": {
  468. "min": {
  469. "type": "number"
  470. },
  471. "max": {
  472. "type": "number"
  473. }
  474. }
  475. },
  476. "currentPosition": {
  477. "type": "string",
  478. "enum": [
  479. "below",
  480. "within",
  481. "above"
  482. ]
  483. },
  484. "bandName": {
  485. "type": "string"
  486. },
  487. "goldenBand": {
  488. "type": "string",
  489. "description": "量利平衡最优带名称"
  490. },
  491. "priceStrategy": {
  492. "type": "string"
  493. },
  494. "marginEstimate": {
  495. "type": "object",
  496. "properties": {
  497. "currentMargin": {
  498. "type": "number",
  499. "description": "当前毛利率%"
  500. },
  501. "suggestedMargin": {
  502. "type": "number"
  503. },
  504. "breakEvenSales": {
  505. "type": "integer"
  506. }
  507. }
  508. },
  509. "promotionAdvice": {
  510. "type": "array",
  511. "items": {
  512. "type": "string"
  513. }
  514. }
  515. }
  516. },
  517. "listingAnalysis": {
  518. "type": "array",
  519. "description": "Listing优化评估",
  520. "items": {
  521. "type": "object",
  522. "properties": {
  523. "dimension": {
  524. "type": "string",
  525. "enum": [
  526. "title",
  527. "bullet",
  528. "searchTerm",
  529. "image",
  530. "a+content"
  531. ]
  532. },
  533. "currentScore": {
  534. "type": "integer"
  535. },
  536. "potentialScore": {
  537. "type": "integer"
  538. },
  539. "tips": {
  540. "type": "array",
  541. "items": {
  542. "type": "string"
  543. }
  544. },
  545. "keywordsToAdd": {
  546. "type": "array",
  547. "items": {
  548. "type": "string"
  549. }
  550. },
  551. "priority": {
  552. "type": "string",
  553. "enum": [
  554. "high",
  555. "medium",
  556. "low"
  557. ]
  558. }
  559. }
  560. }
  561. },
  562. "vocPainPoints": {
  563. "type": "array",
  564. "description": "VOC痛点(差评关键词)",
  565. "items": {
  566. "type": "object",
  567. "properties": {
  568. "painPoint": {
  569. "type": "string"
  570. },
  571. "severity": {
  572. "type": "integer",
  573. "description": "0-100"
  574. },
  575. "frequency": {
  576. "type": "integer"
  577. },
  578. "suggestion": {
  579. "type": "string"
  580. },
  581. "expectedImpact": {
  582. "type": "string",
  583. "enum": [
  584. "high",
  585. "medium",
  586. "low"
  587. ]
  588. }
  589. }
  590. }
  591. },
  592. "adStrategy": {
  593. "type": "array",
  594. "description": "广告策略推荐",
  595. "items": {
  596. "type": "object",
  597. "properties": {
  598. "keyword": {
  599. "type": "string"
  600. },
  601. "matchType": {
  602. "type": "string",
  603. "enum": [
  604. "exact",
  605. "phrase",
  606. "broad"
  607. ]
  608. },
  609. "suggestedBid": {
  610. "type": "number"
  611. },
  612. "expectedAcos": {
  613. "type": "number"
  614. },
  615. "dailyBudget": {
  616. "type": "number"
  617. },
  618. "priority": {
  619. "type": "string",
  620. "enum": [
  621. "high",
  622. "medium",
  623. "low"
  624. ]
  625. },
  626. "reason": {
  627. "type": "string"
  628. }
  629. }
  630. }
  631. },
  632. "aiDiagnosis": {
  633. "type": "string",
  634. "description": "AI生成的核心诊断与运营建议(Markdown格式),包含: 核心诊断/流量架构透视表格/运营建议(PPC+Listing+备货)/30天行动计划"
  635. }
  636. }
  637. },
  638. "timeout": 300000,
  639. "retry": {
  640. "maxAttempts": 2,
  641. "delay": 3000,
  642. "backoffMultiplier": 2
  643. },
  644. "tokenConfig": {
  645. "type": "bearer",
  646. "configFile": "~/.openclaw/voc-credentials.json",
  647. "tokenField": "vocToken",
  648. "resolutionOrder": [
  649. "configFile"
  650. ],
  651. "apigId": "7HwdQZk55B",
  652. "paymentUrlResolution": {
  653. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  654. "steps": [
  655. "1. 从 voc-credentials.json 获取当前 session token",
  656. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  657. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  658. "4. 将该URL展示给用户,引导扫码支付"
  659. ],
  660. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  661. "userResolveHeaders": {
  662. "X-Parse-Application-Id": "ncloudmaster",
  663. "X-Parse-Session-Token": "{vocToken}"
  664. },
  665. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  666. "paymentParams": {
  667. "user": "{resolvedUserId}",
  668. "apigid": "7HwdQZk55B",
  669. "fun_id": "HOkkX72PMF"
  670. },
  671. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  672. },
  673. "onMissing": {
  674. "action": "showPaymentQR",
  675. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  676. "title": "扫码开通 VOC-AI 数据服务",
  677. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  678. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  679. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  680. },
  681. "onBalanceInsufficient": {
  682. "action": "resolveUserThenShowPayment",
  683. "title": "VOC-AI Token 余额不足,请扫码充值",
  684. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  685. }
  686. },
  687. "errorHandling": {
  688. "balanceInsufficient": {
  689. "conditions": [
  690. {
  691. "responseField": "code",
  692. "operator": "in",
  693. "value": [
  694. -2,
  695. -3,
  696. -10,
  697. 402,
  698. 429
  699. ]
  700. },
  701. {
  702. "responseField": "msg",
  703. "operator": "contains",
  704. "value": [
  705. "余额不足",
  706. "insufficient",
  707. "balance",
  708. "quota",
  709. "没有开通",
  710. "权限或余额"
  711. ]
  712. },
  713. {
  714. "responseField": "mess",
  715. "operator": "contains",
  716. "value": [
  717. "余额不足",
  718. "insufficient",
  719. "balance",
  720. "quota",
  721. "没有开通",
  722. "权限或余额"
  723. ]
  724. },
  725. {
  726. "responseField": "message",
  727. "operator": "contains",
  728. "value": [
  729. "余额不足",
  730. "insufficient",
  731. "balance",
  732. "没有开通",
  733. "权限或余额"
  734. ]
  735. }
  736. ],
  737. "matchMode": "any",
  738. "trigger": "tokenConfig.onBalanceInsufficient"
  739. },
  740. "unauthorized": {
  741. "conditions": [
  742. {
  743. "responseField": "code",
  744. "operator": "in",
  745. "value": [
  746. 401,
  747. 403
  748. ]
  749. },
  750. {
  751. "responseField": "msg",
  752. "operator": "contains",
  753. "value": [
  754. "unauthorized",
  755. "token",
  756. "invalid",
  757. "auth"
  758. ]
  759. }
  760. ],
  761. "matchMode": "any",
  762. "trigger": "tokenConfig.onMissing"
  763. }
  764. }
  765. }