Skip to content

yuyingzi/info-ranking

Repository files navigation

Info Ranking

Info Ranking 是一个面向本地部署和自托管场景的信息质量评估服务。它提供 FastAPI 后端和 Streamlit 前端,可用于网页内容打分、特征提取、结果对比和批量排序。

适合用来做什么

  • 为 AI Agent 或检索系统增加内容质量过滤层
  • 对单个 URL 做质量评分与解释
  • 对多个 URL 做排序与筛选
  • 提取来源信誉、内容质量、网络信号等结构化特征
  • 在本地环境中验证 ICP、LLM、DataForSEO 等可选能力

当前状态

  • 默认支持本地部署
  • 默认使用 SQLite
  • 不依赖固定域名、内部配置中心或内部部署平台
  • 外部服务全部通过环境变量配置

快速开始

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
python scripts/start_api.py --reload

另开一个终端启动前端:

source .venv/bin/activate
bash scripts/start_streamlit_network.sh

启动后可访问:

  • 前端:http://localhost:8501
  • 后端:http://localhost:8000
  • API 文档:http://localhost:8000/docs

主要能力

  • 单个 URL 质量评分
  • 两个 URL 的差异对比
  • 批量 URL 排序
  • 特征提取与结构化返回
  • 可选接入 ICPLLMDataForSEO

技术栈

  • 后端:FastAPISQLAlchemyPydantic
  • 前端:StreamlitPlotly
  • 特征处理:BeautifulSoup4PlaywrightNLTK
  • 排序与建模:scikit-learnXGBoost
  • 可选依赖:Redis

常用环境变量

项目通过 .envconfigs/*.yml 组合加载配置,建议从 .env.example 开始。

ENVIRONMENT=development
DATABASE_URL=sqlite:///./data/sentinel.db
REDIS_URL=redis://localhost:6379/0
API_BASE_URL=http://localhost:8000
LOG_LEVEL=INFO

# 可选:LLM
LLM_PROVIDER=deepseek
MODELARTS_API_KEY=
DOUBAO_API_KEY=
OPENROUTER_API_KEY=

# 可选:DataForSEO
DATAFORSEO_USERNAME=
DATAFORSEO_PASSWORD=

# 可选:ICP
ICP_ENABLED=true
ICP_API_URL=https://capi.tianyancha.com/cloud-search-seo/icp/search
ICP_REFERER=https://www.tianyancha.com/

如果你的后端不是本地地址,可以在启动前端前覆盖:

export API_BASE_URL="http://localhost:8000"

API 示例

健康检查:

curl http://localhost:8000/health

文档评分:

curl -X POST "http://localhost:8000/api/v1/document_score" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

文档特征:

curl -X POST "http://localhost:8000/api/v1/document_features" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}'

批量排序:

curl -X POST "http://localhost:8000/api/v1/rank_documents" \
  -H "Content-Type: application/json" \
  -d '{"urls":["https://example.com","https://example.org"],"top_k":1}'

项目结构

Info-ranking/
├── sentinel/         # FastAPI 后端、特征提取、模型与工具
├── streamlit_app/    # Streamlit 前端
├── configs/          # YAML 配置
├── scripts/          # 启动与维护脚本
├── data/             # 本地数据文件(默认不提交私有内容)
├── tests/            # 测试
├── README.md
├── requirements.txt
└── pyproject.toml

文档入口

  • 架构说明:sentinel/ARCHITECTURE.md
  • Streamlit 前端说明:streamlit_app/README.md
  • 贡献指南:CONTRIBUTING.md
  • 安全说明:SECURITY.md
  • 开源发布检查清单:OPEN_SOURCE_RELEASE_CHECKLIST.md
  • 环境变量示例:.env.example

贡献

欢迎通过 Issue 和 Pull Request 提交问题、建议和改进。

License

本项目基于 MIT License 开源,详见 LICENSE

About

No more garbage in,garbage out;守护信息品味,从我做起

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors