feat: 뉴스 전용 페이지 + 분류 격리 + 읽음 상태
- /news 전용 페이지: 신문사 필터, 읽지않음 필터, 시간순 리스트, 미리보기 - 뉴스 분류 격리: ai_domain='News', classify 제거, embed만 등록 - is_read: 클릭 시 자동 읽음, 전체 읽음 API - documents 목록에서 뉴스 제외 (source_channel != 'news') - nav에 뉴스 링크 추가 - GET /api/news/articles, POST /api/news/mark-all-read Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -139,6 +139,7 @@ async def _fetch_rss(session, source: NewsSource) -> int:
|
||||
continue
|
||||
|
||||
category = _normalize_category(source.category or "")
|
||||
source_short = source.name.split(" ")[0] # "경향신문 문화" → "경향신문"
|
||||
|
||||
doc = Document(
|
||||
file_path=f"news/{source.name}/{article_id}",
|
||||
@@ -154,14 +155,14 @@ async def _fetch_rss(session, source: NewsSource) -> int:
|
||||
data_origin="external",
|
||||
edit_url=link,
|
||||
review_status="approved",
|
||||
ai_domain="News",
|
||||
ai_sub_group=source_short,
|
||||
ai_tags=[f"News/{source_short}/{category}"],
|
||||
)
|
||||
session.add(doc)
|
||||
await session.flush()
|
||||
|
||||
# classify + embed 큐 등록 (extract 불필요)
|
||||
session.add(ProcessingQueue(document_id=doc.id, stage="classify", status="pending"))
|
||||
|
||||
# 30일 이내만 embed
|
||||
# embed만 등록 (classify 불필요 — 소스/분야 이미 확정)
|
||||
days_old = (datetime.now(timezone.utc) - pub_dt).days
|
||||
if days_old <= 30:
|
||||
session.add(ProcessingQueue(document_id=doc.id, stage="embed", status="pending"))
|
||||
@@ -219,6 +220,7 @@ async def _fetch_api(session, source: NewsSource) -> int:
|
||||
continue
|
||||
|
||||
category = _normalize_category(article.get("section", source.category or ""))
|
||||
source_short = source.name.split(" ")[0]
|
||||
|
||||
doc = Document(
|
||||
file_path=f"news/{source.name}/{article_id}",
|
||||
@@ -234,12 +236,13 @@ async def _fetch_api(session, source: NewsSource) -> int:
|
||||
data_origin="external",
|
||||
edit_url=link,
|
||||
review_status="approved",
|
||||
ai_domain="News",
|
||||
ai_sub_group=source_short,
|
||||
ai_tags=[f"News/{source_short}/{category}"],
|
||||
)
|
||||
session.add(doc)
|
||||
await session.flush()
|
||||
|
||||
session.add(ProcessingQueue(document_id=doc.id, stage="classify", status="pending"))
|
||||
|
||||
days_old = (datetime.now(timezone.utc) - pub_dt).days
|
||||
if days_old <= 30:
|
||||
session.add(ProcessingQueue(document_id=doc.id, stage="embed", status="pending"))
|
||||
|
||||
Reference in New Issue
Block a user