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)
This commit is contained in:
2026-06-02 10:25:14 +00:00
commit f0ff62e082
21 changed files with 4042 additions and 0 deletions

313
static/style.css Normal file
View File

@@ -0,0 +1,313 @@
/* LLM 论文图书馆 — 前端样式 (提取自 llm_library.html) */
:root {
--bg: #0a0e14;
--bg-card: #12171f;
--bg-modal: #0d1117;
--border: #1e293b;
--text: #c9d1d9;
--text-dim: #8b949e;
--text-bright: #e6edf3;
--blue: #58a6ff; --blue-bg: #0d1b2a; --blue-border: #1a3a5c;
--green: #3fb950; --green-bg: #0d1f14; --green-border: #1a3d1a;
--red: #f85149; --red-bg: #1f0d0d; --red-border: #3d1a1a;
--purple: #bc8cff; --purple-bg: #190d2a; --purple-border: #2d1a3d;
--orange: #d2991d; --orange-bg: #1f160d; --orange-border: #3d2d1a;
--cyan: #39d2c0; --cyan-bg: #0d1f1c; --cyan-border: #1a3d3a;
--pink: #f778ba; --pink-bg: #1f0d1a; --pink-border: #3d1a2d;
--yellow: #e3b341; --yellow-bg: #1f1a0d; --yellow-border: #3d3d1a;
--teal: #79c0ff; --teal-bg: #0d1d2d; --teal-border: #1a2d3d;
--radius: 10px; --radius-sm: 6px; --transition: 0.2s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
background: var(--bg); color: var(--text);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
padding: 32px 24px 60px; min-height: 100vh;
}
.header { text-align: center; margin-bottom: 32px; }
.header h1 {
font-size: 1.5em;
background: linear-gradient(135deg, var(--blue), var(--purple), var(--pink));
-webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.header p { color: var(--text-dim); font-size: 0.85em; margin-top: 4px; }
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 16px; max-width: 1400px; margin: 0 auto;
}
.card {
background: var(--bg-card); border: 1px solid var(--border);
border-radius: var(--radius); padding: 18px 16px;
cursor: pointer; position: relative; overflow: hidden;
transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.card::before {
content: ''; position: absolute; inset: 0;
background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
rgba(88,166,255,0.12) 0%, transparent 60%);
opacity: 0; transition: opacity 0.3s ease;
pointer-events: none; z-index: 0;
}
.card:hover::before { opacity: 1; }
.card:hover {
border-color: rgba(88,166,255,0.4);
box-shadow: 0 0 20px rgba(88,166,255,0.08), inset 0 0 20px rgba(88,166,255,0.03);
}
.card-header, .card-desc, .card-badge { position: relative; z-index: 1; }
.card-icon { font-size: 1.3em; }
.card-desc { font-size: 0.8em; color: var(--text-dim); line-height: 1.5; }
.card-badge {
position: absolute; top: 12px; right: 12px;
font-size: 0.7em; background: rgba(255,255,255,.06);
padding: 2px 8px; border-radius: 10px; color: var(--text-dim);
}
.card-arch { border-left: 3px solid var(--blue); }
.card-multi { border-left: 3px solid var(--cyan); }
.card-data { border-left: 3px solid var(--green); }
.card-pretrain { border-left: 3px solid var(--red); }
.card-post { border-left: 3px solid var(--purple);}
.card-compress { border-left: 3px solid var(--orange);}
.card-deploy { border-left: 3px solid var(--teal); }
.card-agent { border-left: 3px solid var(--pink); }
.card-eval { border-left: 3px solid var(--yellow);}
.card-arch .card-header { color: var(--blue); }
.card-multi .card-header { color: var(--cyan); }
.card-data .card-header { color: var(--green); }
.card-pretrain .card-header { color: var(--red); }
.card-post .card-header { color: var(--purple);}
.card-compress .card-header { color: var(--orange);}
.card-deploy .card-header { color: var(--teal); }
.card-agent .card-header { color: var(--pink); }
.card-eval .card-header { color: var(--yellow);}
/* Modal */
.overlay {
display: none; position: fixed; inset: 0;
background: rgba(0,0,0,.7); z-index: 100;
justify-content: center; align-items: flex-start;
padding: 40px 16px; overflow-y: auto;
}
.overlay.open { display: flex; }
.modal {
background: var(--bg-modal); border: 1px solid var(--border);
border-radius: var(--radius); width: 100%; max-width: 960px;
padding: 28px 24px; position: relative;
animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.modal-close {
position: absolute; top: 16px; right: 16px;
background: none; border: none; color: var(--text-dim);
font-size: 1.4em; cursor: pointer;
width: 36px; height: 36px; border-radius: 50%;
display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,.06); color: var(--text); }
.modal-title { font-size: 1.2em; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.modal-subtitle { color: var(--text-dim); font-size: 0.85em; margin-bottom: 24px; }
/* Tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
padding: 8px 16px; font-size: 0.85em; color: var(--text-dim);
cursor: pointer; border: none; background: none;
border-bottom: 2px solid transparent;
transition: color var(--transition), border-color var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text-bright); border-bottom-color: var(--blue); font-weight: 600; }
/* Section labels */
.section-label {
font-size: 0.78em; font-weight: 700; text-transform: uppercase;
letter-spacing: 1px; margin: 16px 0 8px; padding: 4px 0;
}
.section-label.mainline { color: var(--blue); border-bottom: 1px solid var(--blue-border); }
.section-label.branch { color: var(--orange); border-bottom: 1px solid var(--orange-border); }
.section-label.forward { color: var(--purple); border-bottom: 1px solid var(--purple-border); }
/* Paper item */
.paper-item {
display: flex; align-items: flex-start; gap: 12px;
padding: 10px 12px; border-radius: var(--radius-sm);
margin-bottom: 4px; transition: background var(--transition);
}
.paper-item:hover { background: rgba(255,255,255,.03); }
.paper-year { flex-shrink: 0; width: 42px; font-size: 0.75em; color: var(--text-dim); font-variant-numeric: tabular-nums; text-align: right; padding-top: 1px; }
.paper-body { flex: 1; min-width: 0; }
.paper-title { font-size: 0.9em; font-weight: 600; color: var(--text-bright); line-height: 1.4; margin-bottom: 2px; }
.paper-meta { font-size: 0.75em; color: var(--text-dim); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.paper-venue { color: var(--green); font-weight: 500; }
/* Tags */
.paper-tag { display: inline-block; font-size: 0.7em; padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.tag-start { background: #1a3a5c; color: var(--blue); }
.tag-milestone{ background: #3d1a1a; color: var(--red); }
.tag-frontier { background: #1a3d1a; color: var(--green);}
.tag-forward { background: #2d1a3d; color: var(--purple);}
.tag-branch { background: #3d2d1a; color: var(--orange);}
/* Links */
.paper-links { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.paper-link {
font-size: 0.72em; color: var(--blue); text-decoration: none;
padding: 2px 8px; border: 1px solid var(--blue-border);
border-radius: 4px; transition: background var(--transition); cursor: pointer;
}
.paper-link:hover { background: var(--blue-bg); }
/* Search */
.search-wrap { max-width: 600px; margin: 0 auto 28px; position: relative; }
.search-input {
width: 100%; padding: 10px 16px 10px 38px;
background: var(--bg-card); border: 1px solid var(--border);
border-radius: var(--radius); color: var(--text); font-size: 0.9em; outline: none;
}
.search-input:focus { border-color: var(--blue); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } .modal { padding: 20px 16px; } }
/* PDF viewer */
.pdf-overlay {
display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85);
z-index: 200; justify-content: center; align-items: center;
transition: justify-content 0.3s ease;
}
.pdf-overlay.open { display: flex; }
.pdf-container {
width: 90vw; height: 90vh; background: #fff; border-radius: var(--radius);
display: flex; flex-direction: column; overflow: hidden;
}
.pdf-toolbar {
display: flex; align-items: center; gap: 12px; padding: 10px 16px;
background: #1a1a2e; color: #eee; font-size: 0.85em;
}
.pdf-toolbar button {
background: rgba(255,255,255,.1); border: none; color: #eee;
padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 0.85em;
}
.pdf-toolbar button:hover { background: rgba(255,255,255,.2); }
.pdf-toolbar .pdf-close { margin-left: auto; font-size: 1.2em; }
.pdf-frame { flex: 1; border: none; width: 100%; }
/* Translation */
.trans-btn {
font-size: 0.7em; color: var(--cyan); cursor: pointer;
padding: 2px 6px; border: 1px solid var(--cyan-border);
border-radius: 4px; background: transparent;
margin-left: 4px; transition: background var(--transition);
}
.trans-btn:hover { background: var(--cyan-bg); }
.trans-btn.loading { opacity: 0.5; pointer-events: none; }
.paper-title-zh {
font-size: 0.8em; color: var(--cyan); margin-top: 3px; line-height: 1.4;
}
/* Status bar */
.status-bar {
position: fixed; bottom: 0; left: 0; right: 0;
background: var(--bg-card); border-top: 1px solid var(--border);
display: flex; gap: 20px; align-items: center; padding: 8px 20px;
z-index: 50; font-size: 0.78em; color: var(--text-dim);
}
.status-label {
color: var(--text-dim); font-weight: 600; margin-right: 4px;
}
.status-item {
display: flex; align-items: center; gap: 6px;
}
.status-ms {
color: var(--text-dim); font-variant-numeric: tabular-nums;
margin-left: 2px;
}
.status-dot {
width: 8px; height: 8px; border-radius: 50%;
background: var(--text-dim); transition: background 0.3s;
}
.status-dot.status-ok { background: var(--green); }
.status-dot.status-fail { background: var(--red); }
.pdf-container {
width: 90vw; height: 90vh; background: #fff; border-radius: var(--radius);
display: flex; flex-direction: column; overflow: hidden;
transition: width 0.3s ease;
}
.pdf-container.with-trans { width: 55vw; }
/* Translation panel (right sidebar) */
.trans-panel {
position: fixed; right: -50vw; top: 5vh; bottom: 5vh;
width: 45vw; min-width: 380px; max-width: 650px;
background: var(--bg-modal); border: 1px solid var(--border);
border-radius: var(--radius);
z-index: 201; display: flex; flex-direction: column;
transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
box-shadow: -4px 0 24px rgba(0,0,0,.5);
overflow: hidden;
}
.trans-panel.open { right: 2vw; }
.trans-panel-header {
display: flex; align-items: center; gap: 12px;
padding: 12px 16px; border-bottom: 1px solid var(--border);
font-weight: 700; font-size: 1em; flex-shrink: 0;
}
.trans-panel-close {
margin-left: auto; background: none; border: none;
color: var(--text-dim); font-size: 1.3em; cursor: pointer;
}
.trans-panel-body {
flex: 1; overflow-y: auto; padding: 16px;
scroll-behavior: smooth;
}
.trans-panel-footer {
padding: 10px 16px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.trans-panel-footer button {
background: var(--blue-bg); color: var(--blue);
border: 1px solid var(--blue-border); padding: 6px 16px;
border-radius: 4px; cursor: pointer; font-size: 0.85em;
}
.trans-panel-footer button:hover { background: #1a3a5c; }
.trans-panel-footer button:disabled { opacity: 0.5; cursor: not-allowed; }
.trans-para-group {
margin-bottom: 18px; padding-bottom: 14px;
border-bottom: 1px solid rgba(255,255,255,.04);
transition: background 0.3s ease;
}
.trans-para-group.active {
background: rgba(88,166,255,.06);
border-left: 2px solid var(--blue);
padding-left: 10px;
margin-left: -12px;
padding-right: 4px;
border-radius: 0 4px 4px 0;
}
.trans-en, .trans-zh {
font-size: 0.82em; line-height: 1.65;
}
.trans-page-badge {
font-size: 0.65em; color: var(--text-dim); margin-bottom: 2px;
font-variant-numeric: tabular-nums;
}
.trans-en { color: var(--text); margin-bottom: 4px; }
.trans-zh { color: var(--cyan); padding-left: 8px; border-left: 2px solid var(--cyan-border); }
/* Scroll sync highlight */
.trans-para-group.highlight {
background: rgba(88,166,255,.12);
border-left: 3px solid var(--blue);
padding-left: 9px;
margin-left: -12px;
padding-right: 4px;
border-radius: 0 4px 4px 0;
}