api-config.json 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. {
  2. "name": "html-report-generator",
  3. "displayName": "HTML竞品分析报告生成器",
  4. "description": "整合所有前置Skill输出,AI生成REPORT_DATA JSON,注入report_template.html模板,输出完整可渲染的9屏幻灯片HTML竞品分析报告",
  5. "category": "synthesis",
  6. "version": "1.3.0",
  7. "type": "analysis",
  8. "templateRef": "workflows/templates/report_template.html",
  9. "parameters": {
  10. "industryName": {
  11. "type": "string",
  12. "required": true,
  13. "description": "行业名称,如「香薰家居」「宠物用品」「母婴护理」"
  14. },
  15. "coverBrandEnglish": {
  16. "type": "string",
  17. "required": true,
  18. "description": "封面英文品牌标识,如「HOME FRAGRANCE」「PET CARE」"
  19. },
  20. "reportDate": {
  21. "type": "string",
  22. "required": true,
  23. "description": "报告日期,格式 'YYYY年MM月'"
  24. },
  25. "categoryLandscape": {
  26. "type": "object",
  27. "required": true,
  28. "description": "synthesis/category-landscape 输出(市场全景数据)"
  29. },
  30. "competitorData": {
  31. "type": "object",
  32. "required": true,
  33. "description": "competitor-analysis 汇总输出(竞品发现+对比+定价+追踪)"
  34. },
  35. "reviewAnalysis": {
  36. "type": "object",
  37. "required": true,
  38. "description": "review-analysis 汇总输出(痛点+亮点+情感+关键词云)"
  39. },
  40. "socialVocData": {
  41. "type": "object",
  42. "required": false,
  43. "description": "social-voc 汇总输出(TikTok+Instagram趋势数据)"
  44. },
  45. "userPersona": {
  46. "type": "object",
  47. "required": false,
  48. "description": "synthesis/user-persona 输出"
  49. },
  50. "strategyData": {
  51. "type": "object",
  52. "required": false,
  53. "description": "短/中/长期策略建议,可从voc-proposal输出中提取或手动补充"
  54. }
  55. },
  56. "pipeline": [
  57. {
  58. "step": 1,
  59. "name": "提取模板变量",
  60. "type": "compute",
  61. "logic": "extractTemplateVars(inputs)",
  62. "algorithm": {
  63. "placeholders": {
  64. "industryName": "直接取 inputs.industryName",
  65. "coverBrandEnglish": "直接取 inputs.coverBrandEnglish",
  66. "reportDate": "直接取 inputs.reportDate",
  67. "totalReviews": "从 reviewAnalysis.stats.totalReviews 提取,格式化为 '1,500条'",
  68. "categoryCount": "从 categoryLandscape.topBrands 或 categories 数组长度提取",
  69. "competitorCount": "从 competitorData.competitors 数组长度提取",
  70. "competitorNames": "从 competitorData.competitors 数组提取 brand 字段,逗号分隔"
  71. }
  72. },
  73. "output": "templateVars"
  74. },
  75. {
  76. "step": 2,
  77. "name": "AI生成REPORT_DATA JSON",
  78. "type": "ai",
  79. "logic": "generateReportData(categoryLandscape, competitorData, reviewAnalysis, socialVocData, userPersona, strategyData, templateVars)",
  80. "aiConfig": {
  81. "systemPrompt": "你是跨境电商数据分析专家。请严格按照指定JSON Schema生成REPORT_DATA对象,用于注入HTML幻灯片报告模板。只输出纯JSON,不要有任何注释或额外文字。",
  82. "userPromptTemplate": "请根据以下分析数据生成完整的REPORT_DATA JSON对象:\n\n行业: ${industryName}\n品牌: ${coverBrandEnglish}\n\n【市场全景数据】\n${categoryLandscapeJson}\n\n【竞品数据】\n${competitorDataJson}\n\n【VOC评论分析】\n${reviewAnalysisJson}\n\n【社媒数据】\n${socialVocDataJson}\n\n【用户画像】\n${userPersonaJson}\n\n【策略建议】\n${strategyDataJson}\n\n请严格按照以下Schema生成REPORT_DATA:\n- metrics: 6个核心KPI指标卡片 [{value数字, prefix, suffix, label, sub}]\n- coreFindings: 5条核心发现 [{text, highlight, highlightClass}] highlightClass选'text-sage'(正向)/'text-rose'(负向)/'text-gold'(关键)\n- coreValues: 5条核心价值 [string]\n- categories: 各品类市场数据 [{name,weeklySales,weeklyRevenue,avgPrice,brands,growth,chinaRatio,highlight(bool),revenueNum(数字),growthNum(数字)}]\n- competitors: 竞品卡片数据 [{name,positioning,positionBadge('badge-gold'/'badge-sage'/'badge-rose'/'badge-blue'),priceRange,igFollowers,tiktokFollowers,skuNote,strategyNote,pros,cons,radarData:[5个0-100分值]}]\n- vocAnalysis: {totalReviews,painPoints:[{icon(emoji),name,pct(1-35),gradient('linear-gradient(90deg,...)'),quote}],highlights:[{name,pct(1-100),color('#...')}],scenes:[{name,pct}]}\n- categoryMatrix: [{name,marketSize,growth,socialHeat,competition,chinaRatio,recommendation,badgeClass}]\n- tiktokHeat: [{name(#话题名),plays(数字)}]\n- seasonalNotes: [{icon(emoji),title,desc}]\n- strategy: {shortTerm:[{title,desc}],midTerm:[{title,desc}],longTerm:[{title,desc}]} 每期3-4条\n- vocPriorities: [{text,badgeClass}] 6-8条VOC驱动的优化优先级\n- conclusion: {topCategory:{emoji,title,name,desc},socialDividend:{emoji,title,name,desc},differentiator:{title,subtitle,desc},keyActions:[{emoji,title,desc}]} keyActions 恰好3条",
  83. "outputFormat": "{\"metrics\":[],\"coreFindings\":[],\"coreValues\":[],\"categories\":[],\"competitors\":[],\"vocAnalysis\":{},\"categoryMatrix\":[],\"tiktokHeat\":[],\"seasonalNotes\":[],\"strategy\":{},\"vocPriorities\":[],\"conclusion\":{}}",
  84. "temperature": 0.3,
  85. "maxTokens": 12000,
  86. "promptPattern": "system约束JSON-only输出 + user按模块注入真实数据 + outputFormat示例引导结构"
  87. },
  88. "output": "reportDataJson"
  89. },
  90. {
  91. "step": 3,
  92. "name": "填充模板生成HTML",
  93. "type": "compute",
  94. "logic": "injectIntoTemplate(reportDataJson, templateVars, templateRef)",
  95. "algorithm": {
  96. "templateLoad": "读取 templateRef 路径的 report_template.html 文件内容",
  97. "placeholderReplace": "将模板中所有 {{key}} 替换为 templateVars[key] 对应的值",
  98. "dataInjection": "将 {{REPORT_DATA_JSON}} 替换为 JSON.stringify(reportDataJson, null, 2)",
  99. "output": "完整HTML字符串,可直接写入 .html 文件并在浏览器打开"
  100. },
  101. "output": "htmlContent"
  102. },
  103. {
  104. "step": 4,
  105. "name": "生成报告统计",
  106. "type": "compute",
  107. "logic": "buildReportStats(reportDataJson, templateVars)",
  108. "algorithm": {
  109. "totalSlides": "固定9屏(封面/目录/执行摘要/市场全景/竞品对标/用户VOC/线索清单/执行策略/总结展望)",
  110. "dataCompleteness": "检查reportDataJson各字段非空率,计算0-100数据完整度",
  111. "generatedAt": "生成时间戳 ISO 8601"
  112. },
  113. "output": "reportStats"
  114. }
  115. ],
  116. "response": {
  117. "type": "object",
  118. "properties": {
  119. "htmlContent": {
  120. "type": "string",
  121. "description": "完整HTML字符串,可直接写入 .html 文件在浏览器打开"
  122. },
  123. "reportDataJson": {
  124. "type": "object",
  125. "description": "生成的 REPORT_DATA JSON 对象(可调试复查)",
  126. "properties": {
  127. "metrics": { "type": "array" },
  128. "coreFindings": { "type": "array" },
  129. "categories": { "type": "array" },
  130. "competitors": { "type": "array" },
  131. "vocAnalysis": { "type": "object" },
  132. "categoryMatrix": { "type": "array" },
  133. "strategy": { "type": "object" },
  134. "conclusion": { "type": "object" }
  135. }
  136. },
  137. "templateVars": {
  138. "type": "object",
  139. "description": "填充后的 {{placeholder}} 变量表",
  140. "properties": {
  141. "industryName": { "type": "string" },
  142. "coverBrandEnglish": { "type": "string" },
  143. "totalReviews": { "type": "string" },
  144. "categoryCount": { "type": "string" },
  145. "competitorCount": { "type": "string" },
  146. "competitorNames": { "type": "string" },
  147. "reportDate": { "type": "string" }
  148. }
  149. },
  150. "reportStats": {
  151. "type": "object",
  152. "description": "报告生成统计",
  153. "properties": {
  154. "totalSlides": { "type": "integer" },
  155. "dataCompleteness": { "type": "number", "description": "0-100数据完整度百分比" },
  156. "generatedAt": { "type": "string", "description": "生成时间戳" }
  157. }
  158. }
  159. }
  160. },
  161. "timeout": 300000,
  162. "retry": {
  163. "maxAttempts": 2,
  164. "delay": 3000,
  165. "backoffMultiplier": 2
  166. }
  167. }