fix(nanoclaude): analyze query에서 doc_id 참조 제거 + 기본 분석 요청

"3755번 문서 분석해줘" → Gemma에 "이 문서의 핵심 내용을 분석하고..." 전달

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-16 09:46:46 +09:00
parent 3517581eda
commit 02cc1b3da6
+7 -1
View File
@@ -187,8 +187,14 @@ def _pre_route(message: str) -> dict | None:
doc_id_match = re.search(r'#(\d{3,6})', msg) doc_id_match = re.search(r'#(\d{3,6})', msg)
analyze_signals = ["전체", "요약", "분석", "정리", "읽어", "전문", "자세히"] analyze_signals = ["전체", "요약", "분석", "정리", "읽어", "전문", "자세히"]
if doc_id_match and any(s in msg for s in analyze_signals): if doc_id_match and any(s in msg for s in analyze_signals):
# query에서 doc_id 참조 제거 + 구체적 질문 없으면 기본 분석 요청
clean_query = re.sub(r'#?\d{3,6}\s*번?\s*', '', msg).strip()
clean_query = re.sub(r'^(문서|자료|파일)\s*', '', clean_query).strip()
clean_query = re.sub(r'\s*(해줘|해주세요|줘|좀)\s*$', '', clean_query).strip()
if not clean_query or clean_query in ["분석", "요약", "정리", "전체", "읽어", "전문", "자세히"]:
clean_query = "이 문서의 핵심 내용을 분석하고, 주요 사항과 실무상 중요한 포인트를 정리해주세요."
return {"action": "tools", "tool": "document", "operation": "analyze", return {"action": "tools", "tool": "document", "operation": "analyze",
"params": {"doc_id": doc_id_match.group(1), "query": message}} "params": {"doc_id": doc_id_match.group(1), "query": clean_query}}
# 문서 키워드 — 질문형/탐색형 점수 기반 분기 # 문서 키워드 — 질문형/탐색형 점수 기반 분기
doc_entry = any(k in msg for k in ["문서", "도큐먼트", "자료", "파일"]) doc_entry = any(k in msg for k in ["문서", "도큐먼트", "자료", "파일"])