feat: 영문 RSS 글감 자동 번역+재작성 지원

- 수집 시 영문 소스 자동 감지 (한국어 비율 5% 미만)
- 영문 글감 글쓰기 프롬프트에 번역+한국맥락 재작성 지시 추가
- 한국 시장 비교, 국내 대안 서비스 언급 유도
- 제목도 한국어로 새로 작성하도록 지시

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
JOUNGWOOK KWON
2026-03-30 11:53:01 +09:00
parent af57c3500c
commit e3c963a014
2 changed files with 18 additions and 3 deletions

View File

@@ -386,9 +386,15 @@ def collect_rss_feeds(sources_cfg: dict) -> list[dict]:
pub_at = None
if hasattr(entry, 'published_parsed') and entry.published_parsed:
pub_at = datetime(*entry.published_parsed[:6], tzinfo=timezone.utc).isoformat()
title_text = entry.get('title', '')
desc_text = entry.get('summary', '') or entry.get('description', '')
# 한국어 문자가 거의 없으면 영문 소스로 판단
combined = title_text + desc_text
kr_chars = sum(1 for c in combined if '\uac00' <= c <= '\ud7a3')
is_english = kr_chars / max(len(combined), 1) < 0.05
items.append({
'topic': entry.get('title', ''),
'description': entry.get('summary', '') or entry.get('description', ''),
'topic': title_text,
'description': desc_text,
'source': 'rss',
'source_name': feed_cfg.get('name', ''),
'source_url': entry.get('link', ''),
@@ -397,6 +403,7 @@ def collect_rss_feeds(sources_cfg: dict) -> list[dict]:
'topic_type': 'trending',
'_trust_override': trust,
'_rss_category': feed_cfg.get('category', ''),
'is_english': is_english,
})
except Exception as e:
logger.warning(f"RSS 수집 실패 ({url}): {e}")

View File

@@ -155,13 +155,21 @@ def _build_openclaw_prompt(topic_data: dict) -> tuple[str, str]:
description = topic_data.get('description', '').strip()
source = topic_data.get('source_url') or topic_data.get('source') or ''
published_at = topic_data.get('published_at', '')
is_english = topic_data.get('is_english', False)
system = (
"당신은 'AI? 그게 뭔데?' 블로그의 편집자 eli다. "
"비전문가도 쉽게 읽을 수 있는 친근한 톤으로 글을 쓴다. "
"반드시 아래 섹션 헤더 형식만 사용해 완성된 Blogger-ready HTML 원고를 출력하라. "
"본문(BODY)은 HTML로 작성하고, KEY_POINTS는 3줄 이내로 작성한다."
)
prompt = f"""다음 글감을 바탕으로 한국어 블로그 원고를 작성해줘.
if is_english:
system += (
" 영문 원문을 단순 번역하지 말고, 한국 독자 관점에서 재해석하여 작성하라. "
"한국 시장/사용자에게 어떤 의미인지, 국내 대안이나 비교 서비스가 있다면 함께 언급하라. "
"제목도 한국어로 매력적으로 새로 작성하라."
)
lang_note = "\n⚠️ 영문 원문입니다. 단순 번역이 아닌, 한국 독자 맥락으로 재작성해주세요." if is_english else ""
prompt = f"""다음 글감을 바탕으로 한국어 블로그 원고를 작성해줘.{lang_note}
주제: {topic}
코너: {corner}