geo/docs/01-项目概览/architecture.md

161 lines
9.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 系统架构
## 整体架构
```
┌─────────────────────────────────────────────────────────────┐
│ 前端 (Next.js) │
├─────────────────────────────────────────────────────────────┤
│ Dashboard │ 诊断中心 │ 内容管理 │ 知识库 │ 监控面板 │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ API网关 (FastAPI) │
├─────────────────────────────────────────────────────────────┤
│ Auth │ Brands │ Diagnosis │ Content │ Knowledge │ Monitoring│
└─────────────────────────────────────────────────────────────┘
┌────────────────────┼────────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ PostgreSQL │ │ Redis │ │ LLM Providers │
│ (数据存储) │ │ (缓存/队列) │ │ (AI服务) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
```
## 诊断架构
### SEO诊断
```
网站URL输入 → 爬虫抓取 → 技术分析 → 内容分析 → 外链分析 → 生成SEO诊断报告
```
**诊断维度:**
- 技术SEO索引、爬取、Core Web Vitals
- 页面SEOTitle/Meta、H标签、内链
- 内容质量E-E-A-T、新鲜度、重复内容
- 外链分析(质量、毒性、锚文本)
- 用户体验(移动适配、页面速度)
### GEO诊断
```
品牌信息输入 → 内容可提取性检测 → 实体清晰度检测 → E-E-A-T信号检测
→ Schema标记检测 → 主题权威检测 → AI平台引用检测 → 生成GEO诊断报告
```
**诊断维度:**
- 内容可提取性(直接回答块、问答式标题、列表表格)
- 实体清晰度(品牌定义、目标受众、差异化价值)
- E-E-A-T信号作者资质、专业认证、数据来源
- Schema标记Organization、Product、FAQPage等
- 主题权威(内容深度、话题覆盖度、实体信号一致性)
- 引用就绪度引用频率、引用质量、AI声量占比
## Agent Framework
```
┌─────────────────────────────────────────────────────────────┐
│ Agent Framework │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Dispatcher │→│ Registry │→│ Monitor │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Agents │ │
│ ├───────────┬───────────┬───────────┬────────────┤ │
│ │ Citation │ Content │ DeAI │ GEO │ │
│ │ Detector │ Generator │ Agent │ Optimizer │ │
│ ├───────────┼───────────┼───────────┼────────────┤ │
│ │ Monitor │ Schema │Competitor│ Trend │ │
│ │ Agent │ Advisor │ Analyzer │ Agent │ │
│ └───────────┴───────────┴───────────┴────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Services │ │
│ ├───────────┬───────────┬───────────┬────────────┤ │
│ │ RuleValid │ SEOOptim │ Sensitive │ HTMLGen │ │
│ └───────────┴───────────┴───────────┴────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
```
**Agent职责说明**
| Agent | 职责 | 输入 | 输出 |
|-------|------|------|------|
| CitationDetector | 引用检测 | AI平台响应、品牌名称 | 引用检测结果 |
| ContentGenerator | 内容生成 | 主题、规则库、品牌素材 | GEO优化内容 |
| DeAIAgent | 去AI化 | AI生成内容 | 自然化内容 |
| GEOOptimizer | GEO优化 | 原始内容、关键词策略 | 优化后内容 |
| MonitorAgent | 效果追踪 | 品牌ID、监测配置 | 监测记录、趋势数据 |
| SchemaAdvisor | Schema建议 | 品牌内容、行业类型 | Schema标记建议 |
| CompetitorAnalyzer | 竞品分析 | 品牌、竞品列表 | 竞品洞察报告 |
| TrendAgent | 趋势洞察 | 行业、关键词 | 趋势洞察数据 |
**注意:** 当前项目中的`SEOOptimizer`实际执行的是GEO优化内容结构化、实体优化而非传统SEO优化技术SEO。建议在后续版本中明确区分
- **SEOOptimizer** → 技术SEO优化网站技术层面
- **GEOOptimizer** → 内容实体优化AI引用层面
## GEO 业务闭环
```
诊断 → 策略 → 方案 → 内容生成 → 效果追踪
↑ │
└────────────────────────────────────┘
```
**闭环流程说明:**
| 阶段 | 描述 | 核心Agent/服务 |
|------|------|----------------|
| 诊断 | 品牌GEO现状评估识别优化机会 | CitationDetector, GEOOptimizer |
| 策略 | 基于诊断结果制定GEO优化策略 | StrategyService, CompetitorAnalyzer |
| 方案 | 生成可执行的GEO优化方案 | StrategyService, SchemaAdvisor |
| 内容生成 | 按方案生成GEO优化内容 | ContentGenerator, DeAIAgent |
| 效果追踪 | 持续监测优化效果,驱动下一轮迭代 | MonitorAgent, TrendAgent |
## 品牌评分体系
品牌评分V2采用5维度评分模型全面衡量品牌在AI搜索引擎中的表现
| 维度 | 字段名 | 描述 | 评分范围 |
|------|--------|------|----------|
| 提及率 | mention_rate | 品牌在AI响应中的被提及频率 | 0-100 |
| 推荐排名 | recommendation_rank | 品牌在AI推荐中的排名位置 | 0-100 |
| 情感评分 | sentiment_score | AI对品牌的情感倾向评分 | 0-100 |
| 引用质量 | citation_quality | 品牌被引用内容的质量与权威性 | 0-100 |
| 竞争位置 | competitive_position | 品牌相对竞品的综合竞争位势 | 0-100 |
**综合评分计算:** 综合品牌评分 = 加权平均(mention_rate, recommendation_rank, sentiment_score, citation_quality, competitive_position)
## 内容生成Pipeline
```
用户输入 → 母题选择 → 内容生成 → 去AI化 → GEO优化 → HTML生成 → 输出
```
**注意:** 原Pipeline中的"SEO优化"实际是GEO优化内容结构化不是传统SEO优化。
## 知识库系统
```
文档上传 → 文本分块 → 向量化 → RAG检索 → LLM增强生成
```
## 监控体系
```
API请求 → Prometheus指标 → Grafana可视化
健康检查 → 告警通知
```
## 数据库设计
核心表users, organizations, brands, competitors, queries, citations, alerts, contents, knowledge_bases, knowledge_entities, knowledge_relations, geo_plans, geo_plan_actions, monitoring_records, content_baselines, schema_suggestions, competitor_insights, trend_insights