From e3c963a014701b85962fd6d026ef345d697e3c3b Mon Sep 17 00:00:00 2001 From: JOUNGWOOK KWON Date: Mon, 30 Mar 2026 11:53:01 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=98=81=EB=AC=B8=20RSS=20=EA=B8=80?= =?UTF-8?q?=EA=B0=90=20=EC=9E=90=EB=8F=99=20=EB=B2=88=EC=97=AD+=EC=9E=AC?= =?UTF-8?q?=EC=9E=91=EC=84=B1=20=EC=A7=80=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 수집 시 영문 소스 자동 감지 (한국어 비율 5% 미만) - 영문 글감 글쓰기 프롬프트에 번역+한국맥락 재작성 지시 추가 - 한국 시장 비교, 국내 대안 서비스 언급 유도 - 제목도 한국어로 새로 작성하도록 지시 Co-Authored-By: Claude Opus 4.6 --- bots/collector_bot.py | 11 +++++++++-- bots/scheduler.py | 10 +++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bots/collector_bot.py b/bots/collector_bot.py index 10a2c42..69b68d6 100644 --- a/bots/collector_bot.py +++ b/bots/collector_bot.py @@ -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}") diff --git a/bots/scheduler.py b/bots/scheduler.py index 065fae8..09f9750 100644 --- a/bots/scheduler.py +++ b/bots/scheduler.py @@ -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}