chore: update project config, services, templates and styling

This commit is contained in:
2026-06-06 00:48:05 +08:00
parent 5d4de50c8b
commit 4072a05460
8 changed files with 22 additions and 22 deletions
+3 -3
View File
@@ -26,14 +26,14 @@ class Settings(BaseSettings):
HTTP_MAX_RETRIES: int = 3
HTTP_USER_AGENT: str = "hf-daily-papers-local/0.1"
# AI 总结Phase 2
# AI 总结
PI_BIN: str = ""
SUMMARY_SKILL: str = "daily-paper-summary"
SUMMARY_CONCURRENCY: int = 3
SUMMARY_TIMEOUT_SECONDS: int = 300
SUMMARY_MAX_RETRIES: int = 1
# 调度Phase 4
# 调度
SCHEDULER_ENABLED: bool = False
SCHEDULE_HOUR: int = 8
SCHEDULE_MINUTE: int = 0
@@ -42,7 +42,7 @@ class Settings(BaseSettings):
# 数据库
DATABASE_URL: str = "sqlite:///data/db/papers.db"
# 语义搜索Phase 5
# 语义搜索
CHROMA_ENABLED: bool = False
CHROMA_DIR: str = "data/chroma"
EMBED_API_BASE: str = ""
+1 -1
View File
@@ -72,7 +72,7 @@ def create_app() -> FastAPI:
# 静态文件
app.mount("/static", StaticFiles(directory="app/static"), name="static")
# Phase 5: 论文图片静态服务
# 论文图片静态服务
papers_images_dir = os.path.join("data", "papers")
os.makedirs(papers_images_dir, exist_ok=True)
app.mount("/papers", StaticFiles(directory=papers_images_dir), name="papers")
+4 -4
View File
@@ -101,10 +101,10 @@ def paper_detail(arxiv_id: str, request: Request, db: Session = Depends(get_db))
if paper.summary_status:
summary_state = paper.summary_status.status
# Phase 5: 相似论文推荐
# 相似论文推荐
similar_papers = _get_similar_papers(db, arxiv_id, top_k=6)
# Phase 5: 图片画廊
# 图片画廊
images = _get_paper_images(arxiv_id)
return templates.TemplateResponse(
@@ -121,7 +121,7 @@ def paper_detail(arxiv_id: str, request: Request, db: Session = Depends(get_db))
)
# ── 相似论文 API (Phase 5) ────────────────────────────────────────────
# ── 相似论文 API ──────────────────────────────────────────────────────
@router.get("/api/similar/{arxiv_id}")
@@ -213,7 +213,7 @@ def _get_similar_papers(db: Session, arxiv_id: str, top_k: int = 6) -> list[dict
return []
# ── 图片画廊 (Phase 5) ────────────────────────────────────────────────
# ── 图片画廊 ──────────────────────────────────────────────────────────
def _get_paper_images(arxiv_id: str) -> list[dict]:
+1 -1
View File
@@ -143,7 +143,7 @@ async def delete_papers_by_date_range(
{"paper_id": paper_id},
)
# 1.5 Phase 5: 从 ChromaDB 删除语义索引
# 1.5 从 ChromaDB 删除语义索引
try:
from app.services.embedder import delete_paper
+2 -2
View File
@@ -252,13 +252,13 @@ async def _do_summarize_one(db: Session, paper: Paper) -> dict:
status.raw_output_saved = True
db.commit()
# Phase 5: LaTeX 图片提取(可选增强,失败不影响总结)
# LaTeX 图片提取(可选增强,失败不影响总结)
try:
await extract_images_from_source(arxiv_id)
except Exception:
logger.warning("Failed to extract images for %s", arxiv_id, exc_info=True)
# Phase 5: 同步写入语义索引(失败仅 log
# 同步写入语义索引(失败仅 log
try:
from app.services.embedder import index_paper
+6 -6
View File
@@ -722,7 +722,7 @@ mark {
}
}
/* ── Search Mode Toggle (Phase 5) ─────────────────────────────── */
/* ── Search Mode Toggle ───────────────────────────────────────── */
.search-mode-toggle {
display: flex;
gap: 0;
@@ -751,7 +751,7 @@ mark {
color: #fff;
}
/* ── Similarity Score (Phase 5) ────────────────────────────────── */
/* ── Similarity Score ──────────────────────────────────────────── */
.similarity-score {
font-size: 0.8rem;
color: var(--accent);
@@ -761,7 +761,7 @@ mark {
border-radius: 4px;
}
/* ── Similar Papers (Phase 5) ──────────────────────────────────── */
/* ── Similar Papers ────────────────────────────────────────────── */
.similar-papers {
margin-top: 32px;
padding-top: 24px;
@@ -796,7 +796,7 @@ mark {
color: var(--ink-light);
}
/* ── Trends Dashboard (Phase 5) ────────────────────────────────── */
/* ── Trends Dashboard ──────────────────────────────────────────── */
.trends-page h1 {
font-family: var(--font-body);
font-size: 1.5rem;
@@ -832,7 +832,7 @@ mark {
}
}
/* ── Compare Page (Phase 5) ────────────────────────────────────── */
/* ── Compare Page ──────────────────────────────────────────────── */
.compare-page h1 {
font-family: var(--font-body);
font-size: 1.5rem;
@@ -880,7 +880,7 @@ mark {
font-style: italic;
}
/* ── Image Gallery (Phase 5) ───────────────────────────────────── */
/* ── Image Gallery ─────────────────────────────────────────────── */
.image-gallery {
margin-top: 24px;
}
+2 -2
View File
@@ -123,7 +123,7 @@ endblock %} {% block content %}
<h2>Abstract</h2>
<p class="abstract-en">{{ paper.abstract }}</p>
</section>
{% endif %} {# Phase 5: 图片画廊 #} {% if paper_images %}
{% endif %} {# 图片画廊 #} {% if paper_images %}
<section class="image-gallery">
<h2>论文图片</h2>
<div class="gallery-grid">
@@ -135,7 +135,7 @@ endblock %} {% block content %}
{% endfor %}
</div>
</section>
{% endif %} {# Phase 5: 相似论文推荐 #} {% if similar_papers %}
{% endif %} {# 相似论文推荐 #} {% if similar_papers %}
<section class="similar-papers">
<h2>相似论文推荐</h2>
{% for sp in similar_papers %}