Update README.

This commit is contained in:
666ghj
2025-11-28 00:37:24 +08:00
parent 9321f854ef
commit e251f2dbf1
3 changed files with 43 additions and 58 deletions

View File

@@ -8,6 +8,8 @@
<a href="https://lioncc.ai/" target="_blank"><img src="./static/image/logo_loincc.png" alt="666ghj%2FBettaFish | Trendshift" height="40"/></a>&ensp;
<a href="https://share.302.ai/P66Qe3" target="_blank"><img src="./static/image/logo_302ai.png" alt="666ghj%2FBettaFish | Trendshift" height="40"/></a>
<a href="https://open.anspire.cn/?share_code=3E1FUOUH" target="_blank"><img src="./static/image/logo_anspire.png" alt="666ghj%2FBettaFish | Trendshift" height="50"/></a>
[![GitHub Stars](https://img.shields.io/github/stars/666ghj/BettaFish?style=flat-square)](https://github.com/666ghj/BettaFish/stargazers)
[![GitHub Watchers](https://img.shields.io/github/watchers/666ghj/BettaFish?style=flat-square)](https://github.com/666ghj/BettaFish/watchers)
[![GitHub Forks](https://img.shields.io/github/forks/666ghj/BettaFish?style=flat-square)](https://github.com/666ghj/BettaFish/network)
@@ -23,13 +25,6 @@
</div>
## 🌟 Join Our Official Community
<div align="center">
<img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&height=200&section=header&text=Scan%20to%20Join%20Our%20QQ%20Group&fontSize=40&fontAlignY=35&desc=Welcome%20to%20Our%20Community!&descAlignY=55" alt="Welcome%20to%20Our%20Community!" style="width:60%; max-width:900px; display:block; margin:0 auto;">
<img src="static/image/QQ_Light_Horizenal.png" alt="BettaFish QQ Group QR Code" style="width:60%; max-width:360px; display:block; margin:20px auto 0;">
</div>
## ⚡ Project Overview
**"BettaFish"** is an innovative multi-agent public opinion analysis system built from scratch. It helps break information cocoons, restore the original public sentiment, predict future trends, and assist decision-making. Users only need to raise analysis needs like chatting; the agents automatically analyze 30+ mainstream social platforms at home and abroad and millions of public comments.
@@ -88,6 +83,11 @@ Solomon LionCC BettaFish WeiYu Benefits: Open codecodex.ai Lion Programming Chan
302.AI is a pay-as-you-go enterprise AI resource hub that offers the latest and most comprehensive AI models and APIs on the market, along with a variety of ready-to-use online AI applications.
</details>
<details>
<summary>Provider of core agent capabilities including AI web search, file parsing, and web content scraping: <span style="margin-left: 10px"><a href="https://open.anspire.cn/?share_code=3E1FUOUH" target="_blank"><img src="./static/image/logo_anspire.png" alt="666ghj%2FBettaFish | Trendshift" height="50"/></a></span></summary>
Anspire Open is a leading infrastructure provider for the agent era. We offer developers the core capability stack needed to build powerful agents. Currently available services include AI web search (multiple versions, highly competitive pricing), file parsing (limited-time free), web content scraping (limited-time free), cloud browser automation (Anspire Browser Agent, in beta), multi-turn rewriting, and more. We continue to provide a solid foundation for agents to connect and operate in complex digital worlds. Seamlessly integrates with mainstream agent platforms such as Dify, Coze, and Yuanqi. Through a transparent credit-based billing system and modular design, we provide enterprises with efficient, low-cost customized support to accelerate intelligent transformation.
</details>
## 🏗️ System Architecture
### Overall Architecture Diagram
@@ -114,18 +114,11 @@ Solomon LionCC BettaFish WeiYu Benefits: Open codecodex.ai Lion Programming Chan
| 4 | Strategy Formulation | Develop segmented research strategies based on preliminary results | Internal Decision Modules of Each Agent | - |
| 5-N | **Iterative Phase** | **Forum Collaboration + In-depth Research** | **ForumEngine + All Agents** | **Multi-round cycles** |
| 5.1 | In-depth Research | Each Agent conducts specialized search guided by forum host | Each Agent + Reflection Mechanisms + Forum Guidance | Each cycle |
| 5.2 | Forum Collaboration | ForumEngine monitors Agent communications and generates host summaries | ForumEngine + LLM Host | Each cycle |
| 5.2 | Forum Collaboration | ForumEngine monitors Agent communications and generates host guidance | ForumEngine + LLM Host | Each cycle |
| 5.3 | Communication Integration | Each Agent adjusts research directions based on discussions | Each Agent + forum_reader tool | Each cycle |
| N+1 | Result Integration | Report Agent collects all analysis results and forum content | Report Agent | - |
| N+2 | Report Generation | Dynamically select templates and styles, generate final reports through multiple rounds | Report Agent + Template Engine | - |
### 🆕 Report Engine Highlights
- **IR → HTML/PDF rendering**: New `ReportEngine/renderers/html_renderer.py` and `pdf_renderer.py` ship with a Source Han Serif subset plus offline MathJax/Chart.js/html2canvas; `report_engine_only.py` lets you render reports from the CLI without the web UI.
- **PDF export APIs**: Added `/api/report/export/pdf/<task_id>` and `/api/report/export/pdf-from-ir`, performing Pango dependency checks and returning vector PDFs that mirror the HTML preview.
- **Chart.js safety guardrails**: `utils/chart_validator.py` with optional LLM repair ensures widget payloads are valid, avoiding crashes or XSS from malformed chart configs.
- **Multi-source log console**: Frontend console now uses a double-buffered virtual list with SSE replay; backend exposes `/api/report/log` and `/api/report/log/clear` for quick inspect/reset.
- **Sanitization regression tests**: `tests/test_report_engine_sanitization.py` covers table block auto-repair to keep rendering stable.
| N+2 | IR Intermediate Representation | Dynamically select templates and styles, generate metadata through multiple rounds, assemble into IR intermediate representation | Report Agent + Template Engine | - |
| N+3 | Report Generation | Perform quality checks on chunks, render into interactive HTML report based on IR | Report Agent + Stitching Engine | - |
### Project Code Structure Tree
@@ -215,8 +208,8 @@ BettaFish/
│ ├── prompts/ # Prompt library and schema descriptions
│ │ └── prompts.py # Template selection/layout/budget/chapter prompts
│ ├── renderers/ # IR renderers
│ │ ├── html_renderer.py # Document IRinteractive HTML
│ │ ├── pdf_renderer.py # HTMLPDF export (WeasyPrint)
│ │ ├── html_renderer.py # Document IRinteractive HTML
│ │ ├── pdf_renderer.py # HTMLPDF export (WeasyPrint)
│ │ ├── pdf_layout_optimizer.py # PDF layout optimizer
│ │ └── chart_to_svg.py # Chart to SVG conversion tool
│ ├── state/ # Task/metadata state models
@@ -247,7 +240,7 @@ BettaFish/
│ │ ├── main.py # Deep crawling main program
│ │ ├── keyword_manager.py # Keyword manager
│ │ ├── platform_crawler.py # Platform crawler manager
│ │ └── MediaCrawler/ # Media crawler core (Weibo/TikTok/Xiaohongshu, etc.)
│ │ └── MediaCrawler/ # Media crawler core
│ │ ├── main.py
│ │ ├── config/ # Platform configurations
│ │ ├── media_platform/ # Platform crawler implementations
@@ -268,7 +261,7 @@ BettaFish/
│ │ ├── train.py
│ │ ├── predict.py
│ │ └── ...
│ ├── WeiboMultilingualSentiment/ # Multilingual sentiment analysis (recommended)
│ ├── WeiboMultilingualSentiment/ # Multilingual sentiment analysis
│ │ ├── train.py
│ │ ├── predict.py
│ │ └── ...
@@ -308,13 +301,13 @@ BettaFish/
│ ├── test_report_engine_sanitization.py # ReportEngine security tests
│ └── ...
├── app.py # Flask main application entry point
├── config.py # Global configuration file (unified LLM/DB config management)
├── config.py # Global configuration file
├── .env.example # Environment variable example file
├── docker-compose.yml # Docker multi-service orchestration config
├── Dockerfile # Docker image build file
├── requirements.txt # Python dependency list
├── regenerate_latest_pdf.py # PDF regeneration utility script
├── report_engine_only.py # Report Engine CLI version (no Web interface required)
├── report_engine_only.py # Report Engine CLI version
├── README.md # Chinese documentation
├── README-EN.md # English documentation
├── CONTRIBUTING.md # Chinese contribution guide
@@ -432,19 +425,18 @@ DB_CHARSET=utf8mb4
DB_DIALECT=postgresql
# Database initialization is not required, as it will be checked automatically upon executing app.py
# LLM configuration
# ====================== LLM Configuration ======================
# You can switch each Engine's LLM provider as long as it follows the OpenAI-compatible request format
# The configuration file provides recommended LLMs for each Agent. For initial deployment, please refer to the recommended settings first
# Insight Agent
INSIGHT_ENGINE_API_KEY=
# Insight Agent LLM API BaseUrl, customize API provider
INSIGHT_ENGINE_BASE_URL=
# Insight Agent LLM Model Name, e.g., kimi-k2-0711-preview
INSIGHT_ENGINE_MODEL_NAME=
# Media Agent
...
```
Recommended LLM API Provider: [aihubmix](https://aihubmix.com/?aff=8Ds9)
### 6. Launch System
@@ -471,8 +463,6 @@ python app.py
> Note 2: Data scraping needs to be performed as a separate operation. Please refer to the instructions in section 5.3.
> Note 3: If page display issues occur during remote server deployment, see [PR#45](https://github.com/666ghj/BettaFish/pull/45)
Visit http://localhost:5000 to use the complete system
#### 6.2 Launch Individual Agents
@@ -806,6 +796,13 @@ Thanks to these excellent contributors:
[![Contributors](https://contrib.rocks/image?repo=666ghj/BettaFish)](https://github.com/666ghj/BettaFish/graphs/contributors)
## 🌟 Join Our Official Community
<div align="center">
<img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&height=200&section=header&text=Welcome%20to%20Our%20QQ%20Group!&fontSize=40&fontAlignY=35&desc=Scan%20to%20Join%20Our%20Community&descAlignY=55" alt="Welcome to Our QQ Group!" style="width:60%; max-width:900px; display:block; margin:0 auto;">
<img src="static/image/QQ_Light_Horizenal.png" alt="BettaFish QQ Group QR Code" style="width:60%; max-width:360px; display:block; margin:20px auto 0;">
</div>
## 📈 Project Statistics
<a href="https://www.star-history.com/#666ghj/BettaFish&type=date&legend=top-left">

View File

@@ -26,13 +26,6 @@
</div>
## 🌟 加入官方交流群
<div align="center">
<img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&height=200&section=header&text=欢迎加入我们的技术交流QQ群&fontSize=40&fontAlignY=35&desc=扫描下方二维码加入群聊&descAlignY=55" alt="欢迎加入我们的技术交流QQ群" style="width:60%; max-width:900px; display:block; margin:0 auto;">
<img src="static/image/QQ_Light_Horizenal.png" alt="BettaFish 技术交流群二维码" style="width:60%; max-width:360px; display:block; margin:20px auto 0;">
</div>
## ⚡ 项目概述
“**微舆**” 是一个从0实现的创新型 多智能体 舆情分析系统,帮助大家破除信息茧房,还原舆情原貌,预测未来走向,辅助决策。用户只需像聊天一样提出分析需求,智能体开始全自动分析 国内外30+主流社媒 与 数百万条大众评论。
@@ -121,19 +114,11 @@ LLM模型API赞助<a href="https://aihubmix.com/?aff=8Ds9" target="_blank"><i
| 4 | 策略制定 | 基于初步结果制定分块研究策略 | 各Agent内部决策模块 | - |
| 5-N | **循环阶段** | **论坛协作 + 深度研究** | **ForumEngine + 所有Agent** | **多轮循环** |
| 5.1 | 深度研究 | 各Agent基于论坛主持人引导进行专项搜索 | 各Agent + 反思机制 + 论坛引导 | 每轮循环 |
| 5.2 | 论坛协作 | ForumEngine监控Agent发言并生成主持人总结 | ForumEngine + LLM主持人 | 每轮循环 |
| 5.2 | 论坛协作 | ForumEngine监控Agent发言并生成主持人引导 | ForumEngine + LLM主持人 | 每轮循环 |
| 5.3 | 交流融合 | 各Agent根据讨论调整研究方向 | 各Agent + forum_reader工具 | 每轮循环 |
| N+1 | 结果整合 | Report Agent收集所有分析结果和论坛内容 | Report Agent | - |
| N+2 | 报告生成 | 动态选择模板和样式,多轮生成最终报告 | Report Agent + 模板引擎 | - |
### 🆕 Report Engine 新增能力
- **IR → HTML/PDF 渲染链路**:新增 `ReportEngine/renderers/html_renderer.py``pdf_renderer.py`内置思源宋体子集和MathJax/Chart.js/html2canvas等离线依赖`report_engine_only.py` 支持纯命令行生成报告。
- **PDF 导出接口**:新增 `/api/report/export/pdf/<task_id>``/api/report/export/pdf-from-ir`,导出前自动检查 Pango 依赖并给出可读提示前端一键触发即可获得矢量PDF。
- **Chart.js 安全校验**`utils/chart_validator.py` + LLM 修复链路确保图表数据合法防止错误配置导致前端崩溃或XSS注入。
- **多源日志控制台**:前端控制台双缓冲虚拟列表 + SSE 历史补偿,后端提供 `/api/report/log``/api/report/log/clear` 便捷查看/清空日志。
- **数据清洗回归测试**`tests/test_report_engine_sanitization.py` 覆盖章节表格的容错修复,保证渲染端稳定。
| N+2 | IR中间表示 | 动态选择模板和样式,多轮生成元数据装订为IR中间表示 | Report Agent + 模板引擎 | - |
| N+3 | 报告生成 | 分块进行质量检测基于IR渲染成交互式 HTML 报告 | Report Agent + 装订引擎 | - |
### 项目代码结构树
@@ -223,8 +208,8 @@ BettaFish/
│ ├── prompts/ # 提示词库与Schema说明
│ │ └── prompts.py # 模板选择/布局/篇幅/章节提示词
│ ├── renderers/ # IR渲染器
│ │ ├── html_renderer.py # Document IR交互式HTML
│ │ ├── pdf_renderer.py # HTMLPDF导出WeasyPrint
│ │ ├── html_renderer.py # Document IR交互式HTML
│ │ ├── pdf_renderer.py # HTMLPDF导出WeasyPrint
│ │ ├── pdf_layout_optimizer.py # PDF布局优化器
│ │ └── chart_to_svg.py # 图表转SVG工具
│ ├── state/ # 任务/元数据状态模型
@@ -255,7 +240,7 @@ BettaFish/
│ │ ├── main.py # 深度爬取主程序
│ │ ├── keyword_manager.py # 关键词管理器
│ │ ├── platform_crawler.py # 平台爬虫管理
│ │ └── MediaCrawler/ # 媒爬虫核心(微博/抖音/小红书等)
│ │ └── MediaCrawler/ # 媒爬虫核心
│ │ ├── main.py
│ │ ├── config/ # 各平台配置
│ │ ├── media_platform/ # 各平台爬虫实现
@@ -276,7 +261,7 @@ BettaFish/
│ │ ├── train.py
│ │ ├── predict.py
│ │ └── ...
│ ├── WeiboMultilingualSentiment/ # 多语言情感分析(推荐使用)
│ ├── WeiboMultilingualSentiment/ # 多语言情感分析
│ │ ├── train.py
│ │ ├── predict.py
│ │ └── ...
@@ -316,13 +301,13 @@ BettaFish/
│ ├── test_report_engine_sanitization.py # ReportEngine安全性测试
│ └── ...
├── app.py # Flask主应用入口
├── config.py # 全局配置文件统一管理所有LLM/DB配置
├── config.py # 全局配置文件
├── .env.example # 环境变量示例文件
├── docker-compose.yml # Docker多服务编排配置
├── Dockerfile # Docker镜像构建文件
├── requirements.txt # Python依赖包清单
├── regenerate_latest_pdf.py # PDF重新生成工具脚本
├── report_engine_only.py # Report Engine命令行版本无需Web界面
├── report_engine_only.py # Report Engine命令行版本
├── README.md # 中文说明文档
├── README-EN.md # 英文说明文档
├── CONTRIBUTING.md # 中文贡献指南
@@ -446,18 +431,16 @@ DB_DIALECT=postgresql
# ====================== LLM配置 ======================
# 您可以更改每个部分LLM使用的API只要兼容OpenAI请求格式都可以
# 配置文件内部给了每一个Agent的推荐LLM初次部署请先参考推荐设置
# Insight Agent
INSIGHT_ENGINE_API_KEY=
# Insight Agent LLM接口BaseUrl可自定义厂商API
INSIGHT_ENGINE_BASE_URL=
# Insight Agent LLM模型名称如kimi-k2-0711-preview
INSIGHT_ENGINE_MODEL_NAME=
# Media Agent
...
```
推荐LLM API供应商[推理时代](https://aihubmix.com/?aff=8Ds9)
### 6. 启动系统
@@ -484,8 +467,6 @@ python app.py
> 注2数据爬取需要单独操作见6.3指引
> 注3如果服务器远程部署出现页面显示问题见[PR#45](https://github.com/666ghj/BettaFish/pull/45)
访问 http://localhost:5000 即可使用完整系统
#### 6.2 单独启动某个Agent
@@ -817,6 +798,13 @@ class DeepSearchAgent:
[![Contributors](https://contrib.rocks/image?repo=666ghj/BettaFish)](https://github.com/666ghj/BettaFish/graphs/contributors)
## 🌟 加入官方交流群
<div align="center">
<img src="https://capsule-render.vercel.app/api?type=waving&color=gradient&height=200&section=header&text=欢迎加入我们的技术交流QQ群&fontSize=40&fontAlignY=35&desc=扫描下方二维码加入群聊&descAlignY=55" alt="欢迎加入我们的技术交流QQ群" style="width:60%; max-width:900px; display:block; margin:0 auto;">
<img src="static/image/QQ_Light_Horizenal.png" alt="BettaFish 技术交流群二维码" style="width:60%; max-width:360px; display:block; margin:20px auto 0;">
</div>
## 📈 项目统计
<a href="https://www.star-history.com/#666ghj/BettaFish&type=date&legend=top-left">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 463 KiB

After

Width:  |  Height:  |  Size: 441 KiB