From a116681ed72b295f57c0008c7f042fd30e4f45af Mon Sep 17 00:00:00 2001 From: Variet Agent Date: Sun, 22 Mar 2026 23:58:16 +0900 Subject: [PATCH] =?UTF-8?q?fix(debate):=20slug=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EA=B0=95=ED=99=94=20=E2=80=94=20=EC=98=81=EB=AC=B8=202-3?= =?UTF-8?q?=EB=8B=A8=EC=96=B4,=2030=EC=9E=90=20=EC=A0=9C=ED=95=9C,=20?= =?UTF-8?q?=EB=94=B0=EC=98=B4=ED=91=9C/=ED=8A=B9=EC=88=98=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=20strip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handlers/debate_handler.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/handlers/debate_handler.py b/handlers/debate_handler.py index 89e1330..18cf842 100644 --- a/handlers/debate_handler.py +++ b/handlers/debate_handler.py @@ -85,21 +85,24 @@ class DebateHandler: from core.gemini_caller import GeminiCaller caller = GeminiCaller() short_title = await caller.call_simple( - f"다음 토론 주제를 3~5단어의 짧고 명확한 제목으로 요약해주세요. 마크다운 기호 없이 텍스트만 출력하세요.\n\n주제: {topic}", + f"다음 주제를 2~3단어 영문 키워드로 요약. 따옴표/기호 없이 텍스트만.\n\n주제: {topic}", timeout=30 ) - short_title = short_title.strip() - if len(short_title) > 50: - short_title = short_title[:50] + short_title = short_title.strip().strip('"\'""''「」') + # 특수문자 제거 + import re + short_title = re.sub(r'[^\w\s-]', '', short_title).strip() + if len(short_title) > 30: + short_title = short_title[:30].strip() from tools.wiki_client import WikiClient slug = WikiClient.slugify(short_title) - if len(slug) > 80: - slug = slug[:80].rstrip("-") + if len(slug) > 30: + slug = slug[:30].rstrip("-") except Exception as e: logger.warning(f"짧은 제목 생성 실패: {e}") short_title = topic[:20] - slug = short_title.replace(" ", "-").lower() + slug = re.sub(r'[^\w-]', '-', short_title).lower()[:30].rstrip("-") self.session = DebateSession( topic=topic, topic_slug=slug, wiki_title=short_title,