feat: 뉴스 필터 트리 (신문사 → 분야) + ai_summary 우선 표시

- 좌측 필터: 신문사 펼침 → 분야별 필터 (News/경향신문/문화)
- API: source 파라미터 '신문사' 또는 '신문사/분야' 지원
- 리스트: ai_summary 있으면 우선, 없으면 extracted_text fallback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-06 15:08:50 +09:00
parent 2eeed41f5c
commit 557165db11
2 changed files with 37 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ from typing import Annotated
from fastapi import APIRouter, Depends, HTTPException
from pydantic import BaseModel
from sqlalchemy import select
from sqlalchemy import String, select
from sqlalchemy.ext.asyncio import AsyncSession
from core.auth import get_current_user
@@ -116,7 +116,12 @@ async def list_articles(
Document.deleted_at == None,
)
if source:
query = query.where(Document.ai_sub_group == source)
if '/' in source:
# 신문사/분야 형태 → ai_tags로 필터
query = query.where(Document.ai_tags.cast(String).contains(source))
else:
# 신문사만 → ai_sub_group
query = query.where(Document.ai_sub_group == source)
if unread_only:
query = query.where(Document.is_read == False)