SuperAPI AI Directory

bettafish-opinion-analysis

General & other

View repository

Updated 10-16 07:23

About this skill

BettaFish Public Opinion Analysis System

BettaFish (WeiYu) is ano database dependency, no simulated datamulti-agent public opinion analysis system, adopting QueryAgent + MediaAgent + InsightAgent three-engine parallel architecture, through ForumEngine to enable collaborative discussion among agents, executing 3 rounds of reflection loopsto optimize analysis, ultimatelysimultaneously generating Word/PDF documents and high-quality HTML visualization reports。

Output Deliverables Description

This Skill simultaneously generates reports in three formats, and each format must includerich textual content, not just visual effects:

Report Content Structure Requirements

All reports must include the following8 core chapters, and each chapter requiresdetailed textual analysis and data support:

1. 执行摘要(核心发现 + 关键指标 + 主要结论)
2. 品牌声量与影响力分析(整体趋势 + 渠道分布 + 区域分析)
3. 关键事件深度回顾(时间线 + 多方观点 + 数据支撑)
4. 情感与认知分析(情感光谱 + 品牌联想 + 核心议题)
5. 用户画像分析(人群属性 + 触媒习惯)
6. 声誉风险与机遇洞察(负面议题 + 风险预警 + 正面机遇)
7. 结论与战略建议(SWOT分析 + 优化建议 + 监测重点)
8. 数据附录(指标汇总 + 来源清单)

Content Richness Standards

Each chapter must include:

  • detailed analysis paragraphs: at least 3-5 paragraphs of in-depth analytical text, explaining the insights behind the data
  • specific data support: KPI metrics, percentages, comparative data, etc.
  • multi-dimensional perspectives: cross-analysis of the Query/Media/Insight three engines
  • case explanations: specific events, quotes, user comment examples
  • table presentations: event timelines, data comparisons, source lists, etc.
  • quote blocks: key conclusions, analyst summaries, user verbatim quotes

Prohibited:

  • ❌ Only charts without textual explanation
  • ❌ Only data without analytical insights
  • ❌ Only headings without detailed content
  • ❌ Using placeholders or template text

1. Word Document (.docx)

  • Purpose: formal reporting, printing and archiving, email attachments, submission to superiors
  • Features:
    • clear structure, complete content, standardized format
    • illustrated with both graphics and text: charts accompanied by detailed textual descriptions
    • standard official document format, suitable for formal occasions
  • Generation method: use docx subskill to generate via docx-js

2. PDF Document (.pdf)

  • Purpose: formal reporting, cross-platform sharing, non-editable archiving
  • Features: fixed layout, strong compatibility, professional appearance
  • Generation method: use pdf subskill to generate via reportlab

3. HTML Interactive Report (.html)

  • Purpose: demonstration and display, online sharing, interactive exploration
  • Features: unique editorial magazine-style design, rich interactive visualizations
  • Generation method: use frontend-design subskill to generate

Report Template System

This Skill has built-in 6 professional public opinion analysis report templates, and automatically matches the most suitable template structure based on user needs.

Template Types and Applicable Scenarios

Template Name Applicable Scenario Core Features
Corporate Brand Reputation Analysis Monthly/quarterly brand reputation monitoring Brand image, user perception, reputation risk
Emergencies and Crisis Public Relations Emergency analysis of crisis events Event tracing, dissemination analysis, response strategies
Social Public Hotspot Events Social hotspot tracking Evolution context, dissemination paths, multi-party viewpoints
Market Competition Landscape Analysis Competitor comparison, market share SOV comparison, word-of-mouth comparison, marketing strategies
Specific Policies/Industry Trends Policy interpretation, industry analysis Policy impact, industry response, opportunities and challenges
Daily/Periodic Public Opinion Monitoring Periodic monitoring reports Data dashboard, trend tracking, risk warning

Template Selection Logic

Step 1: Identify the analysis type

Automatically determine the applicable template based on the user query:

关键词匹配规则:
  企业品牌声誉分析:
    - "品牌声誉"
    - "品牌形象"
    - "品牌口碑"
    - "企业舆情"

  突发事件与危机公关:
    - "危机"
    - "突发事件"
    - "负面舆情"
    - "公关"
    - "回应"
    - "道歉"

  社会公共热点事件:
    - "热点事件"
    - "社会热议"
    - "舆论焦点"
    - "公众关注"

  市场竞争格局分析:
    - "竞品"
    - "对比"
    - "竞争"
    - "市场份额"
    - "vs"

  特定政策/行业动态:
    - "政策"
    - "行业"
    - "新规"
    - "监管"

  日常/定期舆情监测:
    - "定期"
    - "周报"
    - "月报"
    - "监测"
    - "追踪"

Step 2: Load the corresponding template structure

Based on the identification result, read the corresponding template file under the assets/templates/ directory to obtain the detailed chapter structure.

Template Usage Instructions

Default Behavior:

  • If the user query does not clearly match any template type, use theCorporate Brand Reputation Analysistemplate as the default structure
  • If the user explicitly requests "competitor comparison", "crisis analysis", etc., automatically switch to the corresponding template

Template Content Filling Requirements:

  • Each chapter must contain 3-5 paragraphs of detailed analysis text
  • The timeline chapter must contain structured tables
  • Comparative analysis must contain data comparison tables
  • Each second-level chapter must have specific cases and data support

Core Architecture

用户查询输入
    ↓
[并行启动三 Agent]
├─ QueryAgent ──┐
├─ MediaAgent ──┼──→ ForumEngine (Agent 讨论协作)
└─ InsightAgent ─┘         ↓
                    [3轮反思循环优化]
                            ↓
                    [ReportEngine 报告生成]
                            ↓
        ├─ docx subskill → Word 文档
        ├─ pdf subskill → PDF 文档
        └─ frontend-design subskill → HTML 报告

Agent Role Division

Agent Responsibilities Data Acquisition Method LLM Recommendation
QueryAgent Web search, news information, forum discussions WebSearch + WebFetch + Browser DeepSeek
MediaAgent Short video/image-text content analysis Download video → video-frames extract frames → analyze Gemini-2.5-pro
InsightAgent Sentiment analysis, keyword extraction, clustering analysis WebSearch + Python script analysis Kimi-K2
ForumHost Moderate Agent discussions, guide research direction LLM generation Qwen-Plus

Design Specification: Editorial Magazine Style

The HTML report adopts the Editorial/Magazine style, following these design principles:

Visual Style

Design Element Specification Description
Overall Style Editorial magazine style High-end publication texture, such as Monocle and Wallpaper
Color Scheme Deep Navy + Warm Gold Primary color #0a192f, accent color #ffd700, creating a sense of professional authority
Font Pairing Playfair Display + Source Serif Pro Serif font combination, conveying elegance and credibility
Layout Features Asymmetric grid + generous whitespace Breaking conventional symmetry, creating visual tension
Motion Design Cinematic scroll-triggered + micro-interactions Page load fade-in, chart animations, hover feedback

Execution Steps

Step 1: Requirement Analysis and Template Selection

1.1 Extract Analysis Elements

分析目标: "品牌声誉/热点追踪/账号挖掘/竞品对比/危机公关/政策分析"
目标主体: "品牌名/事件名/话题关键词"
时间范围: "近7天/近30天/自定义"
输出格式: "Word + PDF + HTML"

1.2 Intelligent Template Selection

Automatically match the most suitable report template based on the user's query content:

def select_report_template(user_query):
    """
    根据用户查询选择报告模板
    返回: (template_name, template_path)
    """
    query = user_query.lower()

    # 模板匹配规则
    template_keywords = {
        "突发事件与危机公关": ["危机", "突发事件", "负面舆情", "公关", "回应", "道歉", "事故"],
        "社会公共热点事件": ["热点事件", "社会热议", "舆论焦点", "公众关注", "热议话题"],
        "市场竞争格局分析": ["竞品", "对比", "竞争", "市场份额", "vs", "比较"],
        "特定政策或行业动态": ["政策", "行业", "新规", "监管", "法规", "指导意见"],
        "日常或定期舆情监测": ["定期", "周报", "月报", "监测", "追踪", "日报"],
        "企业品牌声誉分析": ["品牌声誉", "品牌形象", "品牌口碑", "企业舆情", "声誉"]
    }

    # 匹配逻辑
    for template_name, keywords in template_keywords.items():
        if any(kw in query for kw in keywords):
            return template_name, f"assets/templates/{template_name}报告模板.md"

    # 默认使用品牌声誉模板
    return "企业品牌声誉分析", "assets/templates/企业品牌声誉分析报告模板.md"

Template selection examples:

User Query Automatically Selected Template
"Analyze the social media reputation of a certain coffee chain brand" Corporate Brand Reputation Analysis
"Crisis analysis of a safety incident at a certain music festival" Emergencies and Crisis Public Relations
"Compare the public opinion performance of Coca-Cola and Pepsi" Market Competition Landscape Analysis
"Track the impact of new environmental regulations on the beverage industry" Specific Policies or Industry Trends
"Our company's brand public opinion monitoring this week" Daily or Periodic Public Opinion Monitoring

1.3 Load Template Structure

Read the selected template file to obtain the detailed chapter structure:

# 读取模板文件
template_content = read_file(selected_template_path)

# 解析章节结构
report_structure = parse_template_structure(template_content)

# 输出示例:
# {
#   "模板名称": "企业品牌声誉分析",
#   "章节": [
#     {"1.0": "摘要与核心发现", "子章节": ["1.1", "1.2", "1.3"]},
#     {"2.0": "品牌声量与影响力分析", "子章节": ["2.1", "2.2", "2.3"]},
#     ...
#   ]
# }

1.4 Keyword Optimization

Generate targeted search keywords based on the selected template type:

模板类型: "企业品牌声誉分析"
基础关键词: "某咖啡连锁品牌"
优化后关键词:
  QueryAgent:
    - "某咖啡品牌 用户评价 口碑"
    - "某咖啡品牌 产品 质量"
    - "某咖啡品牌 体验 评测"
  MediaAgent:
    - "某咖啡品牌 抖音 视频"
    - "某咖啡品牌 小红书 种草"
  InsightAgent:
    - "某咖啡品牌 情感分析"
    - "某咖啡品牌 舆情"

Step 2: Start Three Agents in Parallel (ForumEngine Collaboration)

All Agents start simultaneously, execute independently, and share findings through ForumEngine:

QueryAgent Execution Flow:

  1. Use WebSearch to search news/forums/blogs
  2. Use Browser to visit key pages and obtain detailed content
  3. Use WebFetch to obtain structured page data
  4. Extract key information and generate a preliminary summary
  5. Publish findings to ForumEngine

MediaAgent Execution Flow:

  1. Use WebSearch to search for short video/image-text content links
  2. Download relevant video files locally
  3. Use video-frames subskill to extract key frames
  4. Analyze video frame content (visuals, text, scenes)
  5. Publish findings to ForumEngine

InsightAgent Execution Flow:

  1. Use WebSearch to obtain supplementary data
  2. Perform sentiment analysis (based on a rule engine)
  3. Extract keywords and trending topics
  4. Use search_clustering.py to perform cluster sampling on search results
  5. Publish findings to ForumEngine

Step 3: ForumEngine Agent Discussion (3-Round Reflection Loop)

ForumEngine Mechanism:

  • Each Agent submits findings to the forum in a structured format
  • ForumHost (moderator) generates guidance after collecting every 3 Agent statements
  • The moderator proposes new research questions and directions
  • Agents conduct the next round of search and analysis based on the guidance

3-Round Reflection Loop:

第1轮:初步搜索 → Agent 发言 → 主持人引导
第2轮:深度搜索 → Agent 补充 → 主持人总结
第3轮:验证搜索 → Agent 确认 → 最终结论

Step 4: Data Integration and Knowledge Graph Construction

  1. Collect all findings from the three Agents and ForumEngine
  2. Use graph_generator.py to build the knowledge graph
  3. Generate D3.js force-directed graph data

Step 5: Dual-format report generation (based on the selected template)

⚠️ Key: Strictly generate the report according to the template structure selected in Step 1

5.1 Read the template structure

# 获取 Step 1 选定的模板
template_structure = load_template(selected_template_path)

# 按模板章节结构遍历生成内容
for chapter in template_structure.chapters:
    for subsection in chapter.subsections:
        # 根据子章节类型生成对应内容
        content = generate_content_by_type(subsection.title, agent_findings)

5.2 Content generation specifications

Each chapter must include:

  • Detailed analysis paragraphs: 3-5 paragraphs of in-depth analysis text
  • Data tables: timelines, comparison tables, etc.
  • Highlight boxes: important findings
  • Quote blocks: analyst summaries
  • Three-engine cross analysis: Query/Media/Insight perspectives

Content type determination:

  • Title contains "timeline" → generate a structured timeline table
  • Title contains "comparison" → generate a data comparison table
  • Other → generate 3-5 analysis paragraphs

5.3 Generate three formats simultaneously

A. Word document(use docx subskill)

  • Structure: cover + table of contents + 8 chapters of body text + appendix
  • Fonts: body text in SimSun, headings in SimHei
  • Format: 1.5 line spacing, first-line indent of 2 characters
  • Usedocx-jsgenerated via JavaScript

B. PDF document(use pdf subskill)

  • Fixed layout, Chinese font support
  • Usereportlabgenerated via Python
  • Chinese fonts must be registered (SimSun/SimHei)

C. HTML report(use frontend-design subskill)

  • Editorial magazine-style design
  • Deep navy blue (#0a192f) background + gold (#ffd700) accents
  • Playfair Display + Source Serif Pro fonts
  • Includes ECharts charts and D3.js knowledge graph
  • Paginated navigation + keyboard operation support

5.4 Report quality check

  • Three Agents completed parallel execution
  • ForumEngine completed 3 rounds of discussion
  • All data comes from real WebSearch
  • Generate Word, PDF, and HTML formats simultaneously
  • Each chapter contains 3-5 paragraphs of detailed analysis text
  • Includes data tables and charts
  • HTML report has chapter navigation

Data collection specifications

QueryAgent data acquisition

Use the agent's built-in tools; simulated data is prohibited:

1. WebSearch("某咖啡连锁品牌 口碑评价")
2. WebSearch("site:weibo.com 某咖啡品牌")
3. Browser 访问关键页面获取详细内容
4. WebFetch 获取页面结构化数据
5. Curl 命令行获取 API 数据或特殊页面

Curl usage example:

# API 数据获取
curl -s "https://api.social-media.com/posts?q=某咖啡品牌"

# 带 Headers 的页面请求
curl -s -H "User-Agent: Mozilla/5.0" \
  -H "Accept: application/json" \
  "https://www.example.com/api/data"

# 获取并重定向输出到 Python 处理
curl -s "https://api.example.com/data" | python -c "import sys,json; print(json.load(sys.stdin))"

MediaAgent video analysis

Real video analysis workflow:

1. WebSearch 搜索视频链接(抖音、B站、小红书)
2. 下载视频到本地临时目录
3. 使用 video-frames subskill 提取关键帧:

   {baseDir}/scripts/frame.sh /tmp/video.mp4 --time 00:00:05 --out /tmp/frame_5s.jpg

4. 分析视频帧内容(画面元素、文字、场景)
5. 结合视频描述文字进行综合分析

InsightAgent data analysis

Use Python scripts for analysis:

# 情感分析
from scripts.sentiment_analyzer import SentimentAnalyzer
analyzer = SentimentAnalyzer()
results = analyzer.analyze_batch(texts)

# 搜索结果聚类采样
from scripts.search_clustering import cluster_search_results
clusters = cluster_search_results(search_results, n_clusters=5)

Built-in tool usage

1. Search result clustering sampling (search_clustering.py)

from scripts.search_clustering import cluster_search_results, sample_from_clusters

# 对搜索结果进行 KMeans 聚类
clusters = cluster_search_results(
    results=search_results,
    n_clusters=5,
    samples_per_cluster=3
)

# 返回每个聚类的代表性样本
representative_samples = sample_from_clusters(clusters)

2. Sentiment analysis (sentiment_analyzer.py)

from scripts.sentiment_analyzer import SentimentAnalyzer, analyze_sentiment_distribution

analyzer = SentimentAnalyzer()
result = analyzer.analyze("这个产品真的很棒!")
# 返回: label, confidence, positive_score, negative_score, fine_emotions, aspects

3. Knowledge graph construction (graph_generator.py)

from scripts.graph_generator import KnowledgeGraphBuilder

builder = KnowledgeGraphBuilder(topic="某咖啡连锁品牌")
builder.build_from_analysis_result(
    query_results=query_data,
    media_results=media_data,
    insight_results=insight_data
)
graph_data = builder.to_dict()

ForumEngine collaboration protocol

Agent speech format

{
  "agent": "QueryAgent",
  "round": 1,
  "findings": {
    "key_points": ["发现1", "发现2"],
    "sources": [{"title": "...", "url": "..."}],
    "confidence": 0.85
  },
  "questions": ["需要进一步验证的问题"]
}

Moderator guidance format

{
  "host": "ForumHost",
  "round": 1,
  "summary": "本轮讨论总结",
  "directions": ["下一步研究方向1", "方向2"],
  "questions": ["需要回答的关键问题"]
}

Quality check checklist

Check before generating the report:

  • Three Agents completed parallel execution
  • ForumEngine completed 3 rounds of discussion
  • All data comes from real WebSearch, no simulated data
  • Video analysis uses video-frames to extract frames
  • Search results are processed through clustering and sampling
  • Simultaneously generates three formats: Word, PDF, and HTML
  • Word is generated using the docx subskill, with standardized formatting
  • PDF is generated using the pdf subskill
  • HTML uses the frontend-design subskill, editorial magazine style
  • The sentiment distribution pie chart uses an artistic design
  • The trend chart has cinematic animation effects
  • The knowledge graph is interactive (D3.js force-directed graph)
  • Supports PDF export functionality
  • Does not use any database or deep learning models

Subskills Invocation Methods

video-frames

# 提取视频帧
{baseDir}/subskills/video-frames/scripts/frame.sh /path/to/video.mp4 --time 00:00:10 --out /tmp/frame.jpg

docx

// 生成 Word 文档
const { Document, Packer } = require('docx');
// ... 详见 docx subskill 文档

frontend-design

使用 frontend-design subskill 生成 HTML 报告
- 深海军蓝 (#0a192f) 背景
- 金色 (#ffd700) 强调
- Playfair Display 字体
- 电影级动画效果

pdf

from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate
# ... 详见 pdf subskill 文档

Version History

  • v1.0.0 - Initial version
    • Implemented the three-engine parallel architecture of QueryAgent + MediaAgent + InsightAgent
    • Implemented collaborative discussion between ForumEngine Agents
    • Implemented 3 rounds of reflection loop optimization
    • Integrated video-frames, docx, frontend-design, and pdf subskills
    • Simultaneously outputs three formats: Word, PDF, and HTML
    • No database dependency, no simulated data
    • Search result clustering and sampling