1. 项目概述
1.1 背景
在 GEO(生成式引擎优化)领域,如何量化评估一个品牌在 AI 搜索中的"可见性"一直是
技术难点。传统的 SEO 有明确的排名指标,但 AI 搜索的推荐机制更加复杂,难以直接量
化。
本文介绍 GEO 数据面板 V2.0 的技术架构设计,核心解决两个问题:
1. 如何建立可量化的 AI 可见性评估体系
2. 如何实现持续、稳定的效果监测
1.2 核心指标体系
指标名称 说明 取值范围
AI 可见性评分 品牌在 AI 搜索中的综合可
见度
0-10 分
AI 推荐率 品牌被 AI 主动推荐的比例 0-100%
场景覆盖率 品牌在各类搜索场景中的覆
盖程度
0-100%
2. 系统架构设计
2.1 整体架构
系统采用四层架构设计:
层级 名称 核心组件
第一层 数据采集层 豆包接
口、ChatGPT、Claude、
文心一言
第二层 数据处理层 关键词解析、情感分析、场
景匹配

第三层 评分计算层 可见性评分、推荐率计算、
场景覆盖
第四层 数据展示层 仪表盘、趋势图、报告生成
2.2 核心类设计
以下是核心数据模型类的 Python 实现:
# geo_panel/models.py
# 核心数据模型
from dataclasses import dataclass
from typing import List, Dict, Optional
from datetime import datetime
from enum import Enum
class PlatformType(Enum):
"""支持的 AI 平台"""
DOUBAO = "doubao"
CHATGPT = "chatgpt"
CLAUDE = "claude"
WENXIN = "wenxin"
@dataclass
class KeywordContext:
"""关键词上下文"""
keyword: str # 关键词
brand_mentioned: bool # 品牌是否被提及
mention_position: int # 提及位置: 0=未提及, 1=靠后, 2=靠前, 3=首位
sentiment_score: float # 情感倾向 -1.0 ~ 1.0
context_relevance: float # 上下文相关性 0.0 ~ 1.0
@dataclass
class VisibilityMetrics:
"""可见性指标"""
timestamp: datetime # 记录时间
ai_visibility_score: float # AI 可见性评分 0-10 分
recommendation_rate: float # AI 推荐率 0-100%
scene_coverage: float # 场景覆盖率 0-100%
keywords_tested: int # 测试关键词数量
platforms_checked: List[PlatformType] # 检测平台列表
@dataclass
class ClientData:
"""客户数据"""

client_id: str # 客户编号
client_name: str # 客户名称(脱敏)
industry: str # 所属行业
core_keywords: List[str] # 核心关键词列表
metrics_history: List[VisibilityMetrics] # 指标历史记录
def get_latest_metrics(self) -> Optional[VisibilityMetrics]:
"""获取最新指标"""
if not self.metrics_history:
return None
return self.metrics_history[-1]
def calculate_improvement(self, days: int = 90) -> Dict[str, float]:
"""计算改善幅度"""
pass
3. AI 可见性评分算法
3.1 评分模型
评分算法基于四个维度加权计算:
评分维度 权重 说明
品牌提及 35% 是否被 AI 推荐中提及
推荐位置 25% 推荐位置排名(首位/靠
前/靠后/未提及)
情感倾向 20% 推荐语的情感倾向评分
内容相关性 20% 推荐内容与搜索关键词的相
关程度
# geo_panel/scoring.py
# AI 可见性评分器
import numpy as np
from typing import List
from geo_panel.models import KeywordContext
class VisibilityScorer:
"""AI 可见性评分器,基于多维度权重计算综合评分"""
# 评分权重配置
WEIGHTS = {

"brand_mention": 0.35, # 品牌提及权重
"position": 0.25, # 位置权重
"sentiment": 0.20, # 情感权重
"relevance": 0.20, # 相关性权重
}
def calculate_keyword_score(self, context: KeywordContext) -> float:
"""计算单个关键词得分,返回 0-10 分"""
# 品牌提及得分
mention_score = 10.0 if context.brand_mentioned else 0.0
# 位置得分
position_scores = {0: 0.0, 1: 3.0, 2: 7.0, 3: 10.0}
position_score = position_scores.get(context.mention_position, 0.0)
# 情感得分(转换到 0-10 范围)
sentiment_score = (context.sentiment_score + 1) * 5
# 相关性得分
relevance_score = context.context_relevance * 10
# 加权求和
total_score = (
mention_score * self.WEIGHTS["brand_mention"] +
position_score * self.WEIGHTS["position"] +
sentiment_score * self.WEIGHTS["sentiment"] +
relevance_score * self.WEIGHTS["relevance"]
)
return round(total_score, 2)
def calculate_visibility_score(self, keyword_contexts: List[KeywordContext])
-> float:
"""计算综合可见性评分,返回 0-10 分"""
if not keyword_contexts:
return 0.0
keyword_scores = [self.calculate_keyword_score(ctx) for ctx in
keyword_contexts]
scores_array = np.array(keyword_scores)
# 动态权重:得分越低权重越低
weights = (scores_array / 10.0) * 0.5 + 0.5
weighted_avg = np.average(scores_array, weights=weights)
return round(weighted_avg, 2)
def calculate_recommendation_rate(self, keyword_contexts:
List[KeywordContext], total_queries: int) -> float:
"""计算推荐率百分比"""

mentioned_count = sum(1 for ctx in keyword_contexts if
ctx.brand_mentioned)
rate = (mentioned_count / len(keyword_contexts)) * 100
return round(rate, 2)
4. 数据采集模块
4.1 多平台采集器
系统采用异步采集架构,支持多平台并行查询:
# geo_panel/collectors.py
# 多平台数据采集器
import asyncio
import aiohttp
from typing import List, Dict
from geo_panel.models import PlatformType, KeywordContext
class BaseCollector:
"""采集器基类"""
def __init__(self, platform: PlatformType):
self.platform = platform
self.api_endpoint = self._get_api_endpoint()
def _get_api_endpoint(self) -> str:
"""获取 API 端点 - 子类实现"""
raise NotImplementedError
async def query(self, keyword: str, client_brand: str, session:
aiohttp.ClientSession) -> KeywordContext:
"""查询单个关键词"""
raise NotImplementedError
class DoubaoCollector(BaseCollector):
"""豆包采集器"""
def __init__(self):
super().__init__(PlatformType.DOUBAO)
self.api_key = "YOUR_API_KEY"
def _get_api_endpoint(self) -> str:
return "https://api.doubao.com/v1/chat/completions"

async def query(self, keyword: str, client_brand: str, session:
aiohttp.ClientSession) -> KeywordContext:
"""向豆包查询"""
headers = {
"Authorization": f"Bearer {self.api_key}",
"Content-Type": "application/json"
}
payload = {
"model": "doubao-pro",
"messages": [{"role": "user", "content": f"{keyword},有哪些靠谱的推
荐?"}],
"temperature": 0.7
}
async with session.post(self.api_endpoint, json=payload,
headers=headers) as response:
result = await response.json()
return self._parse_response(result, client_brand)
def _parse_response(self, response: Dict, brand: str) -> KeywordContext:
"""解析响应,提取品牌提及信息"""
content = response.get("choices", [{}])[0].get("message",
{}).get("content", "")
brand_mentioned = brand in content
mention_position = self._get_mention_position(content, brand)
sentiment = 0.5 if brand_mentioned else 0.0
relevance = 0.7 if brand_mentioned else 0.3
return KeywordContext(
keyword="", brand_mentioned=brand_mentioned,
mention_position=mention_position,
sentiment_score=sentiment, context_relevance=relevance
)
def _get_mention_position(self, content: str, brand: str) -> int:
"""判断品牌在推荐中的位置"""
if brand not in content:
return 0 # 未提及
lines = content.split("\n")
for i, line in enumerate(lines):
if brand in line:
if i == 0: return 3 # 首位
elif i < len(lines) // 2: return 2 # 靠前
else: return 1 # 靠后
return 1
class MultiPlatformCollector:
"""多平台采集管理器"""

def __init__(self):
self.collectors: Dict[PlatformType, BaseCollector] = {
PlatformType.DOUBAO: DoubaoCollector(),
}
async def collect_batch(self, keywords: List[str], brand: str, platforms:
List[PlatformType]) -> List[KeywordContext]:
"""批量采集多个关键词在多个平台的数据"""
results = []
async with aiohttp.ClientSession() as session:
for keyword in keywords:
for platform in platforms:
if platform in self.collectors:
collector = self.collectors[platform]
context = await collector.query(keyword, brand, session)
context.keyword = keyword
results.append(context)
return results
5. 数据存储与展示
5.1 数据存储设计
采用 SQLite 轻量级数据库,包含三张核心表:
表名 用途 核心字段
客户表 存储客户基本信息 客户编号、客户名称、所属
行业
关键词表 管理客户关键词 编号、客户编号、关键词
指标历史表 记录每次评估的指标数据 客户编号、可见性评分、推
荐率、场景覆盖率、记录时

# geo_panel/storage.py
# 数据存储管理
import sqlite3
from datetime import datetime
from typing import List
from geo_panel.models import VisibilityMetrics
class DataStorage:

"""数据存储管理"""
def __init__(self, db_path: str = "geo_panel.db"):
self.db_path = db_path
self._init_database()
def _init_database(self):
"""初始化数据库表结构"""
conn = sqlite3.connect(self.db_path)
cursor = conn.cursor()
# 客户表
cursor.execute("""
CREATE TABLE IF NOT EXISTS clients (
client_id TEXT PRIMARY KEY,
client_name TEXT NOT NULL,
industry TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
""")
# 关键词表
cursor.execute("""
CREATE TABLE IF NOT EXISTS keywords (
id INTEGER PRIMARY KEY AUTOINCREMENT,
client_id TEXT,
keyword TEXT,
FOREIGN KEY (client_id) REFERENCES clients(client_id)
)
""")
# 指标历史表
cursor.execute("""
CREATE TABLE IF NOT EXISTS metrics_history (
id INTEGER PRIMARY KEY AUTOINCREMENT,
client_id TEXT,
ai_visibility_score REAL,
recommendation_rate REAL,
scene_coverage REAL,
keywords_tested INTEGER,
platforms_checked TEXT,
recorded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (client_id) REFERENCES clients(client_id)
)
""")
conn.commit()
conn.close()
def save_metrics(self, client_id: str, metrics: VisibilityMetrics):
"""保存指标数据"""

conn = sqlite3.connect(self.db_path)
cursor = conn.cursor()
cursor.execute("""
INSERT INTO metrics_history
(client_id, ai_visibility_score, recommendation_rate,
scene_coverage, keywords_tested, platforms_checked)
VALUES (?, ?, ?, ?, ?, ?)
""", (client_id, metrics.ai_visibility_score,
metrics.recommendation_rate, metrics.scene_coverage,
metrics.keywords_tested,
",".join([p.value for p in metrics.platforms_checked])))
conn.commit()
conn.close()
def get_client_metrics_history(self, client_id: str, days: int = 90) ->
List[VisibilityMetrics]:
"""获取客户指标历史记录"""
conn = sqlite3.connect(self.db_path)
cursor = conn.cursor()
cursor.execute("""
SELECT ai_visibility_score, recommendation_rate,
scene_coverage, keywords_tested, recorded_at
FROM metrics_history
WHERE client_id = ? AND recorded_at >= datetime('now', ?)
ORDER BY recorded_at ASC
""", (client_id, f"-{days} days"))
results = cursor.fetchall()
conn.close()
return [VisibilityMetrics(
timestamp=datetime.fromisoformat(row[4]),
ai_visibility_score=row[0], recommendation_rate=row[1],
scene_coverage=row[2], keywords_tested=row[3],
platforms_checked=[]
) for row in results]
6. 使用示例
6.1 完整使用流程
# geo_panel/example.py
# 完整使用示例
import asyncio

from geo_panel.collectors import MultiPlatformCollector
from geo_panel.scoring import VisibilityScorer
from geo_panel.storage import DataStorage
from geo_panel.models import PlatformType, VisibilityMetrics
from datetime import datetime
async def run_geo_assessment():
"""运行 GEO 评估完整流程"""
# 配置评估参数
client_brand = "某宝鸡开锁企业"
keywords = ["宝鸡 24 小时开锁", "宝鸡开锁电话", "宝鸡专业开锁", "宝鸡开锁服务"]
platforms = [PlatformType.DOUBAO]
# 第一步:数据采集
print("正在采集数据...")
collector = MultiPlatformCollector()
contexts = await collector.collect_batch(keywords, client_brand, platforms)
# 第二步:计算评分
print("正在计算可见性评分...")
scorer = VisibilityScorer()
visibility_score = scorer.calculate_visibility_score(contexts)
recommendation_rate = scorer.calculate_recommendation_rate(
contexts, len(keywords) * len(platforms)
)
# 第三步:输出结果
print(f"\n{'='*50}")
print(f"GEO 评估报告")
print(f"{'='*50}")
print(f"品牌: {client_brand}")
print(f"AI 可见性评分: {visibility_score}/10")
print(f"推荐率: {recommendation_rate}%")
print(f"测试关键词: {len(keywords)}个")
print(f"测试平台: {len(platforms)}个")
# 第四步:保存数据
print("\n 正在保存数据...")
storage = DataStorage()
metrics = VisibilityMetrics(
timestamp=datetime.now(),
ai_visibility_score=visibility_score,
recommendation_rate=recommendation_rate,
scene_coverage=0.0,
keywords_tested=len(keywords),
platforms_checked=platforms

)
print("数据已保存!")
if __name__ == "__main__":
asyncio.run(run_geo_assessment())
7. 总结与展望
7.1 当前成果
基于上述架构,实现了:
 AI 可见性评分从主观判断到可量化评估
 多平台数据统一采集和分析
 历史数据追踪和趋势分析
7.2 典型案例数据
行业 优化前评分 优化后评分 提升幅度
本地生活服务 2.3 7.5 226%↑
B2B 制造业 3.0 7.8 160%↑
专业设备 3.0 7.2 140%↑
7.3 未来方向
3. 支持更多 AI 平台
4. 引入机器学习优化评分模型
5. 开发自动化报告生成功能
 专业内容创作


免责声明
本文为技术架构分享,代码仅供参考学习。数据来源于实战案例,已做脱敏处理。技术实
现可能因平台 API 变化需要调整。如有技术交流需求,欢迎联系。

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐