From b41e8d0ff2e0a3eb160a892966c7e11da2301809 Mon Sep 17 00:00:00 2001 From: JOUNGWOOK KWON Date: Mon, 30 Mar 2026 15:39:57 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20/idea=20=ED=83=80=EC=9E=84=EC=95=84?= =?UTF-8?q?=EC=9B=83=20=E2=80=94=20=EB=A6=AC=EB=8B=A4=EC=9D=B4=EB=A0=89?= =?UTF-8?q?=ED=8A=B8/=ED=81=AC=EB=A1=A4=EB=A7=81=20=EC=A0=9C=EA=B1=B0?= =?UTF-8?q?=ED=95=98=EA=B3=A0=20RSS=EB=A7=8C=20=ED=8C=8C=EC=8B=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- bots/scheduler.py | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/bots/scheduler.py b/bots/scheduler.py index 3b385eb..3d74f8f 100644 --- a/bots/scheduler.py +++ b/bots/scheduler.py @@ -742,14 +742,25 @@ async def cmd_idea(update: Update, context: ContextTypes.DEFAULT_TYPE): await update.message.reply_text("❌ 키워드를 입력하세요.") return - await update.message.reply_text(f"🔎 관련 자료 검색 중...\n키워드: {keyword}") + # 네트워크 없이 즉시 topic_data 생성 + if not corner: + corner = _guess_corner(keyword, keyword) - loop = asyncio.get_event_loop() - try: - topic_data = await loop.run_in_executor(None, _search_and_build_topic, keyword, corner) - except Exception as e: - await update.message.reply_text(f"❌ 검색 실패: {e}") - return + topic_data = { + 'topic': keyword, + 'description': f"{keyword}에 대한 최신 정보와 분석", + 'source': 'idea', + 'source_name': '직접 입력', + 'source_url': '', + 'published_at': datetime.now().strftime('%Y-%m-%d'), + 'corner': corner, + 'quality_score': 85, + 'search_demand_score': 9, + 'topic_type': 'trending', + 'source_image': '', + 'is_english': not any('\uAC00' <= c <= '\uD7A3' for c in keyword), + 'sources': [], + } # topics 폴더에 저장 topics_dir = DATA_DIR / 'topics' @@ -764,21 +775,11 @@ async def cmd_idea(update: Update, context: ContextTypes.DEFAULT_TYPE): all_files = sorted(topics_dir.glob(f'{today}_*.json')) idx = next((i for i, f in enumerate(all_files, 1) if f.name == filename), len(all_files)) - # 검색 결과 요약 - sources = topic_data.get('sources', []) - source_lines = [] - for s in sources[:3]: - source_lines.append(f" • {s.get('title', '')[:40]}") - - sources_text = '\n'.join(source_lines) if source_lines else " (직접 검색 결과 없음 — AI가 자체 지식으로 작성)" - await update.message.reply_text( - f"✅ 글감 등록 완료! (#{idx})\n\n" - f"주제: {topic_data.get('topic', '')}\n" + f"✅ 글감 등록! (#{idx})\n" + f"주제: {topic_data.get('topic', '')[:60]}\n" f"카테고리: {topic_data.get('corner', '')}\n\n" - f"📰 참고 자료:\n{sources_text}\n\n" - f"👉 /write {idx} 로 바로 글 작성\n" - f"👉 /write {idx} AI인사이트 로 카테고리 변경 가능" + f"👉 /write {idx}" )