Update README.
This commit is contained in:
+35
-47
@@ -23,7 +23,9 @@
|
|||||||
|
|
||||||
## ⚡ Project Overview
|
## ⚡ Project Overview
|
||||||
|
|
||||||
**"WeiYu"** is an innovative multi-agent public opinion analysis system built from scratch, not limited to Weibo, and features universal simplicity and applicability across all platforms.
|
**"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.
|
||||||
|
|
||||||
|
> Betta is a small yet combative and beautiful fish, symbolizing "small but powerful, fearless of challenges".
|
||||||
|
|
||||||
See the system-generated research report on "Wuhan University Public Opinion": [In-depth Analysis Report on Wuhan University's Brand Reputation](./final_reports/final_report__20250827_131630.html)
|
See the system-generated research report on "Wuhan University Public Opinion": [In-depth Analysis Report on Wuhan University's Brand Reputation](./final_reports/final_report__20250827_131630.html)
|
||||||
|
|
||||||
@@ -103,10 +105,7 @@ Weibo_PublicOpinion_AnalysisSystem/
|
|||||||
├── InsightEngine/ # Private database mining Agent
|
├── InsightEngine/ # Private database mining Agent
|
||||||
│ ├── agent.py # Agent main logic
|
│ ├── agent.py # Agent main logic
|
||||||
│ ├── llms/ # LLM interface wrapper
|
│ ├── llms/ # LLM interface wrapper
|
||||||
│ │ ├── deepseek.py # DeepSeek API
|
│ │ └── base.py # Unified OpenAI-compatible client
|
||||||
│ │ ├── kimi.py # Kimi API
|
|
||||||
│ │ ├── openai_llm.py # OpenAI format API
|
|
||||||
│ │ └── base.py # LLM base class
|
|
||||||
│ ├── nodes/ # Processing nodes
|
│ ├── nodes/ # Processing nodes
|
||||||
│ │ ├── base_node.py # Base node class
|
│ │ ├── base_node.py # Base node class
|
||||||
│ │ ├── formatting_node.py # Formatting node
|
│ │ ├── formatting_node.py # Formatting node
|
||||||
@@ -130,7 +129,6 @@ Weibo_PublicOpinion_AnalysisSystem/
|
|||||||
├── ReportEngine/ # Multi-round report generation Agent
|
├── ReportEngine/ # Multi-round report generation Agent
|
||||||
│ ├── agent.py # Agent main logic
|
│ ├── agent.py # Agent main logic
|
||||||
│ ├── llms/ # LLM interfaces
|
│ ├── llms/ # LLM interfaces
|
||||||
│ │ └── gemini.py # Gemini API dedicated
|
|
||||||
│ ├── nodes/ # Report generation nodes
|
│ ├── nodes/ # Report generation nodes
|
||||||
│ │ ├── template_selection.py # Template selection node
|
│ │ ├── template_selection.py # Template selection node
|
||||||
│ │ └── html_generation.py # HTML generation node
|
│ │ └── html_generation.py # HTML generation node
|
||||||
@@ -230,7 +228,7 @@ playwright install chromium
|
|||||||
|
|
||||||
#### 4.1 Configure API Keys
|
#### 4.1 Configure API Keys
|
||||||
|
|
||||||
Edit the `config.py` file and fill in your API keys (you can also choose your own models and search proxies; please see the config file for details):
|
Edit the `config.py` file and fill in your API keys (you can also choose your own models and search proxies; see the config file for details):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# MySQL Database Configuration
|
# MySQL Database Configuration
|
||||||
@@ -238,26 +236,18 @@ DB_HOST = "localhost"
|
|||||||
DB_PORT = 3306
|
DB_PORT = 3306
|
||||||
DB_USER = "your_username"
|
DB_USER = "your_username"
|
||||||
DB_PASSWORD = "your_password"
|
DB_PASSWORD = "your_password"
|
||||||
DB_NAME = "weibo_analysis"
|
DB_NAME = "your_db_name"
|
||||||
DB_CHARSET = "utf8mb4"
|
DB_CHARSET = "utf8mb4"
|
||||||
|
|
||||||
# DeepSeek API (Apply at: https://www.deepseek.com/)
|
# LLM configuration
|
||||||
DEEPSEEK_API_KEY = "your_deepseek_api_key"
|
# You can switch each Engine's LLM provider as long as it follows the OpenAI-compatible request format
|
||||||
|
|
||||||
# Tavily Search API (Apply at: https://www.tavily.com/)
|
# Insight Agent
|
||||||
TAVILY_API_KEY = "your_tavily_api_key"
|
INSIGHT_ENGINE_API_KEY = "your_api_key"
|
||||||
|
INSIGHT_ENGINE_BASE_URL = "https://api.moonshot.cn/v1"
|
||||||
# Kimi API (Apply at: https://www.kimi.com/)
|
INSIGHT_ENGINE_MODEL_NAME = "kimi-k2-0711-preview"
|
||||||
KIMI_API_KEY = "your_kimi_api_key"
|
# Media Agent
|
||||||
|
...
|
||||||
# Gemini API (Apply at: https://api.chataiapi.com/)
|
|
||||||
GEMINI_API_KEY = "your_gemini_api_key"
|
|
||||||
|
|
||||||
# Bocha Search API (Apply at: https://open.bochaai.com/)
|
|
||||||
BOCHA_Web_Search_API_KEY = "your_bocha_api_key"
|
|
||||||
|
|
||||||
# Silicon Flow API (Apply at: https://siliconflow.cn/)
|
|
||||||
GUIJI_QWEN3_API_KEY = "your_guiji_api_key"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 4.2 Database Initialization
|
#### 4.2 Database Initialization
|
||||||
@@ -373,30 +363,28 @@ SENTIMENT_CONFIG = {
|
|||||||
|
|
||||||
### Integrate Different LLM Models
|
### Integrate Different LLM Models
|
||||||
|
|
||||||
The system supports multiple LLM providers, switchable in each agent's configuration:
|
The system supports any LLM provider that follows the OpenAI request format. You only need to fill in KEY, BASE_URL, and MODEL_NAME in `config.py`.
|
||||||
|
|
||||||
```python
|
> What is the OpenAI request format? Here's a simple example:
|
||||||
# Configure in each Engine's utils/config.py
|
>```python
|
||||||
class Config:
|
>from openai import OpenAI
|
||||||
default_llm_provider = "deepseek" # Options: "deepseek", "openai", "kimi", "gemini", "qwen"
|
>
|
||||||
|
>client = OpenAI(api_key="your_api_key",
|
||||||
# DeepSeek configuration
|
> base_url="https://api.siliconflow.cn/v1")
|
||||||
deepseek_api_key = "your_api_key"
|
>
|
||||||
deepseek_model = "deepseek-chat"
|
>response = client.chat.completions.create(
|
||||||
|
> model="Qwen/Qwen2.5-72B-Instruct",
|
||||||
# OpenAI compatible configuration
|
> messages=[
|
||||||
openai_api_key = "your_api_key"
|
> {
|
||||||
openai_model = "gpt-3.5-turbo"
|
> 'role': 'user',
|
||||||
openai_base_url = "https://api.openai.com/v1"
|
> 'content': "What new opportunities will reasoning models bring to the market?"
|
||||||
|
> }
|
||||||
# Kimi configuration
|
> ],
|
||||||
kimi_api_key = "your_api_key"
|
>)
|
||||||
kimi_model = "moonshot-v1-8k"
|
>
|
||||||
|
>complete_response = response.choices[0].message.content
|
||||||
# Gemini configuration
|
>print(complete_response)
|
||||||
gemini_api_key = "your_api_key"
|
>```
|
||||||
gemini_model = "gemini-pro"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Change Sentiment Analysis Models
|
### Change Sentiment Analysis Models
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,9 @@
|
|||||||
|
|
||||||
## ⚡ 项目概述
|
## ⚡ 项目概述
|
||||||
|
|
||||||
“**微舆**” 是一个从0实现的创新型 多智能体 舆情分析系统,不止微博,全平台简洁通用。
|
“**微舆**” 是一个从0实现的创新型 多智能体 舆情分析系统,帮助大家破除信息茧房,还原舆情原貌,预测未来走向,辅助决策。用户只需像聊天一样提出分析需求,智能体开始全自动分析 国内外30+主流社媒 与 数百万条大众评论。
|
||||||
|
|
||||||
|
> “微舆”谐音“微鱼”,BettaFish是一种体型很小但非常好斗、漂亮的鱼,它象征着“小而强大,不畏挑战”。
|
||||||
|
|
||||||
查看系统以“武汉大学舆情”为例,生成的研究报告:[武汉大学品牌声誉深度分析报告](./final_reports/final_report__20250827_131630.html)
|
查看系统以“武汉大学舆情”为例,生成的研究报告:[武汉大学品牌声誉深度分析报告](./final_reports/final_report__20250827_131630.html)
|
||||||
|
|
||||||
@@ -103,10 +105,7 @@ Weibo_PublicOpinion_AnalysisSystem/
|
|||||||
├── InsightEngine/ # 私有数据库挖掘Agent
|
├── InsightEngine/ # 私有数据库挖掘Agent
|
||||||
│ ├── agent.py # Agent主逻辑
|
│ ├── agent.py # Agent主逻辑
|
||||||
│ ├── llms/ # LLM接口封装
|
│ ├── llms/ # LLM接口封装
|
||||||
│ │ ├── deepseek.py # DeepSeek API
|
│ │ └── base.py # 统一的 OpenAI 兼容客户端
|
||||||
│ │ ├── kimi.py # Kimi API
|
|
||||||
│ │ ├── openai_llm.py # OpenAI格式API
|
|
||||||
│ │ └── base.py # LLM基类
|
|
||||||
│ ├── nodes/ # 处理节点
|
│ ├── nodes/ # 处理节点
|
||||||
│ │ ├── base_node.py # 基础节点类
|
│ │ ├── base_node.py # 基础节点类
|
||||||
│ │ ├── formatting_node.py # 格式化节点
|
│ │ ├── formatting_node.py # 格式化节点
|
||||||
@@ -130,7 +129,6 @@ Weibo_PublicOpinion_AnalysisSystem/
|
|||||||
├── ReportEngine/ # 多轮报告生成Agent
|
├── ReportEngine/ # 多轮报告生成Agent
|
||||||
│ ├── agent.py # Agent主逻辑
|
│ ├── agent.py # Agent主逻辑
|
||||||
│ ├── llms/ # LLM接口
|
│ ├── llms/ # LLM接口
|
||||||
│ │ └── gemini.py # Gemini API专用
|
|
||||||
│ ├── nodes/ # 报告生成节点
|
│ ├── nodes/ # 报告生成节点
|
||||||
│ │ ├── template_selection.py # 模板选择节点
|
│ │ ├── template_selection.py # 模板选择节点
|
||||||
│ │ └── html_generation.py # HTML生成节点
|
│ │ └── html_generation.py # HTML生成节点
|
||||||
@@ -238,31 +236,26 @@ DB_HOST = "localhost"
|
|||||||
DB_PORT = 3306
|
DB_PORT = 3306
|
||||||
DB_USER = "your_username"
|
DB_USER = "your_username"
|
||||||
DB_PASSWORD = "your_password"
|
DB_PASSWORD = "your_password"
|
||||||
DB_NAME = "weibo_analysis"
|
DB_NAME = "your_db_name"
|
||||||
DB_CHARSET = "utf8mb4"
|
DB_CHARSET = "utf8mb4"
|
||||||
|
|
||||||
# DeepSeek API(申请地址:https://www.deepseek.com/)
|
# LLM配置
|
||||||
DEEPSEEK_API_KEY = "your_deepseek_api_key"
|
# 您可以更改每个部分LLM使用的API,只要兼容OpenAI请求格式都可以
|
||||||
|
|
||||||
# Tavily搜索API(申请地址:https://www.tavily.com/)
|
# Insight Agent
|
||||||
TAVILY_API_KEY = "your_tavily_api_key"
|
INSIGHT_ENGINE_API_KEY = "your_api_key"
|
||||||
|
INSIGHT_ENGINE_BASE_URL = "https://api.moonshot.cn/v1"
|
||||||
# Kimi API(申请地址:https://www.kimi.com/)
|
INSIGHT_ENGINE_MODEL_NAME = "kimi-k2-0711-preview"
|
||||||
KIMI_API_KEY = "your_kimi_api_key"
|
# Media Agent
|
||||||
|
...
|
||||||
# Gemini API(申请地址:https://api.chataiapi.com/)
|
|
||||||
GEMINI_API_KEY = "your_gemini_api_key"
|
|
||||||
|
|
||||||
# 博查搜索API(申请地址:https://open.bochaai.com/)
|
|
||||||
BOCHA_Web_Search_API_KEY = "your_bocha_api_key"
|
|
||||||
|
|
||||||
# 硅基流动API(申请地址:https://siliconflow.cn/)
|
|
||||||
GUIJI_QWEN3_API_KEY = "your_guiji_api_key"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 4.2 数据库初始化
|
#### 4.2 数据库初始化
|
||||||
|
|
||||||
**选择1:使用本地数据库**
|
**选择1:使用本地数据库**
|
||||||
|
|
||||||
|
> MindSpider爬虫系统跟舆情系统是各自独立的,所以需要再去`MindSpider\config.py`配置一下
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 本地MySQL数据库初始化
|
# 本地MySQL数据库初始化
|
||||||
cd MindSpider
|
cd MindSpider
|
||||||
@@ -373,30 +366,26 @@ SENTIMENT_CONFIG = {
|
|||||||
|
|
||||||
### 接入不同的LLM模型
|
### 接入不同的LLM模型
|
||||||
|
|
||||||
系统支持多种LLM提供商,可在各Agent的配置中切换:
|
支持任意openAI调用格式的LLM提供商,只需要在/config.py中填写对应的KEY、BASE_URL、MODEL_NAME即可。
|
||||||
|
|
||||||
```python
|
> 什么是openAI调用格式?下面提供一个简单的例子:
|
||||||
# 在各Engine的utils/config.py中配置
|
>```python
|
||||||
class Config:
|
>from openai import OpenAI
|
||||||
default_llm_provider = "deepseek" # 可选: "deepseek", "openai", "kimi", "gemini","qwen"等
|
>
|
||||||
|
>client = OpenAI(api_key="your_api_key",
|
||||||
# DeepSeek配置
|
> base_url="https://api.siliconflow.cn/v1")
|
||||||
deepseek_api_key = "your_api_key"
|
>
|
||||||
deepseek_model = "deepseek-chat"
|
>response = client.chat.completions.create(
|
||||||
|
> model="Qwen/Qwen2.5-72B-Instruct",
|
||||||
# OpenAI兼容配置
|
> messages=[
|
||||||
openai_api_key = "your_api_key"
|
> {'role': 'user',
|
||||||
openai_model = "gpt-3.5-turbo"
|
> 'content': "推理模型会给市场带来哪些新的机会"}
|
||||||
openai_base_url = "https://api.openai.com/v1"
|
> ],
|
||||||
|
>)
|
||||||
# Kimi配置
|
>
|
||||||
kimi_api_key = "your_api_key"
|
>complete_response = response.choices[0].message.content
|
||||||
kimi_model = "moonshot-v1-8k"
|
>print(complete_response)
|
||||||
|
>```
|
||||||
# Gemini配置
|
|
||||||
gemini_api_key = "your_api_key"
|
|
||||||
gemini_model = "gemini-pro"
|
|
||||||
```
|
|
||||||
|
|
||||||
### 更改情感分析模型
|
### 更改情感分析模型
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user