Files
llm-library/README.md
LaoWang f0ff62e082 feat: LLM 论文图书馆 — 初始提交
- FastAPI 后端: REST API + Bearer Token 鉴权 + PDF 代理
- 180 篇论文数据 (data/papers.json): 9 模块、32 子领域
- 前端: 数据驱动、卡片径向渐变光效、PDF 页面内阅读
- 底部状态栏: arXiv/HF 连通性检测
- PDF 加载: arXiv 优先(5s超时) → HK 本地兜底
- Docker 化部署 (Dockerfile + start.sh + nginx.conf)
- arXiv + HF 批量下载器 (api/downloader.py)
2026-06-02 10:25:14 +00:00

124 lines
3.3 KiB
Markdown
Raw 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.
# LLM 论文图书馆
大模型全链路技术论文知识库 — 从架构设计到 Agent 应用,覆盖 9 大模块、30+ 子领域、180+ 篇关键论文。
**在线访问:** https://your-domain.com
**API 文档:** https://your-domain.com/docs (FastAPI Swagger)
## 项目结构
```
llm-library/
├── api/
│ ├── server.py # FastAPI 服务 (REST API + PDF 代理)
│ ├── downloader.py # PDF 批量下载器
│ ├── parse_papers.py # 从 HTML 提取论文数据
│ └── extract_data.py # 备用提取脚本
├── data/
│ └── papers.json # 论文元数据 (单一数据源)
├── papers/
│ ├── arxiv/ # arXiv PDF 缓存
│ └── hf/ # HuggingFace PDF 缓存
├── static/ # 前端 (index.html + CSS + JS)
├── start.sh # 一键启动
├── requirements.txt
└── pyproject.toml
```
## 快速启动
```bash
# 1. 配置 API Key
echo "API_KEY=$(python3 -c 'import secrets; print(secrets.token_urlsafe(32))')" > .env
# 2. 安装依赖
pip install -r requirements.txt
# 3. 启动服务
bash start.sh
# 或
python3 -m uvicorn api.server:app --host 0.0.0.0 --port 8000
```
服务启动后访问 `http://localhost:8000` 即可使用。
## API 接口
| 方法 | 路径 | 说明 | 鉴权 |
|------|------|------|------|
| GET | `/api/stats` | 图书馆统计 | 无 |
| GET | `/api/modules` | 列出所有模块 | 无 |
| GET | `/api/modules/{id}` | 获取模块详情 (含论文) | 无 |
| GET | `/api/papers?q=xxx` | 搜索论文 | 无 |
| POST | `/api/papers` | 添加论文 | Bearer Token |
| PUT | `/api/papers` | 更新论文 | Bearer Token |
| DELETE | `/api/papers` | 删除论文 | Bearer Token |
| GET | `/papers/arxiv/{id}.pdf` | 本地 PDF 代理 | 无 |
### 管理接口示例
```bash
# 添加一篇论文
curl -X POST http://localhost:8000/api/papers \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"module_id": "arch",
"area_id": "attention",
"section": "mainline",
"title": "Paper Title Here",
"authors": "Author et al.",
"year": 2026,
"venue": "arXiv",
"arxiv": "2601.01234",
"tags": ["前沿"]
}'
```
## PDF 下载
```bash
# 下载所有论文 PDF 到本地 (增量)
python3 api/downloader.py
# 只下载前 5 篇测试
python3 api/downloader.py --limit 5
# 强制重新下载
python3 api/downloader.py --no-incremental
```
## 部署 (Nginx 反向代理)
```nginx
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
# 静态文件直接由 Nginx 服务 (可选, 提升性能)
location /style.css { alias /path/to/llm-library/static/style.css; }
location /app.js { alias /path/to/llm-library/static/app.js; }
}
```
## 数据维护
论文数据存储在 `data/papers.json`,也可通过 API 管理。
**标签系统:**
- 🏁 **起点** — 该子领域的奠基论文
- 🔴 **关键节点** — 改变技术方向的里程碑论文
- 🟢 **前沿** — 当前 SOTA已被主流模型采纳
- 🟣 **前瞻** — 有潜力的想法,尚未被主流采纳 (如 Engram, Titans)
- 🟠 **支线** — 有影响力的替代技术路线
## 许可证
MIT