From 5887c4287db77019687c5e602050a4c3bc91d197 Mon Sep 17 00:00:00 2001 From: rain-bus Date: Sat, 6 Jun 2026 00:48:05 +0800 Subject: [PATCH] update project files --- .env.example | 6 +++--- app/config.py | 6 +++--- app/main.py | 2 +- app/routes/pages.py | 8 ++++---- app/services/cleaner.py | 2 +- app/services/summarizer.py | 4 ++-- app/static/css/style.css | 12 ++++++------ app/templates/detail.html | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.env.example b/.env.example index 156331a..288a08b 100644 --- a/.env.example +++ b/.env.example @@ -16,14 +16,14 @@ HTTP_TIMEOUT_SECONDS=30 HTTP_MAX_RETRIES=3 HTTP_USER_AGENT=hf-daily-papers-local/0.1 -# ─── AI 总结(Phase 2 使用)────────────── +# ─── AI 总结 ────────────────────────────── PI_BIN=/home/rainbus/.local/share/mise/installs/pi/latest/pi SUMMARY_SKILL=daily-paper-summary SUMMARY_CONCURRENCY=3 SUMMARY_TIMEOUT_SECONDS=300 SUMMARY_MAX_RETRIES=1 -# ─── 调度(Phase 4 使用)───────────────── +# ─── 调度 ───────────────────────────────── SCHEDULER_ENABLED=false SCHEDULE_HOUR=8 SCHEDULE_MINUTE=0 @@ -32,7 +32,7 @@ APP_WORKERS=1 # ─── 数据库 ───────────────────────────── DATABASE_URL=sqlite:///data/db/papers.db -# ─── 语义搜索(Phase 5 增强,暂留空)───── +# ─── 语义搜索 ───────────────────────────── CHROMA_ENABLED=false CHROMA_DIR=data/chroma EMBED_API_BASE= diff --git a/app/config.py b/app/config.py index f537bb7..b68f8be 100644 --- a/app/config.py +++ b/app/config.py @@ -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 = "" diff --git a/app/main.py b/app/main.py index 8943786..daf0637 100644 --- a/app/main.py +++ b/app/main.py @@ -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") diff --git a/app/routes/pages.py b/app/routes/pages.py index 4c12c8d..50d4652 100644 --- a/app/routes/pages.py +++ b/app/routes/pages.py @@ -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]: diff --git a/app/services/cleaner.py b/app/services/cleaner.py index 414b6a9..9a21b99 100644 --- a/app/services/cleaner.py +++ b/app/services/cleaner.py @@ -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 diff --git a/app/services/summarizer.py b/app/services/summarizer.py index 94d70d5..90dcd52 100644 --- a/app/services/summarizer.py +++ b/app/services/summarizer.py @@ -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 diff --git a/app/static/css/style.css b/app/static/css/style.css index 5c16b04..8df6f1b 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -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; } diff --git a/app/templates/detail.html b/app/templates/detail.html index 255ae99..825184b 100644 --- a/app/templates/detail.html +++ b/app/templates/detail.html @@ -123,7 +123,7 @@ endblock %} {% block content %}

Abstract

{{ paper.abstract }}

- {% endif %} {# Phase 5: 图片画廊 #} {% if paper_images %} + {% endif %} {# 图片画廊 #} {% if paper_images %} - {% endif %} {# Phase 5: 相似论文推荐 #} {% if similar_papers %} + {% endif %} {# 相似论文推荐 #} {% if similar_papers %}

相似论文推荐

{% for sp in similar_papers %}