From 81e2e22ac391af502ae7b7f98ce877fdc5a1cb99 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Tue, 14 Oct 2025 22:41:25 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20=EC=9D=98=EC=82=AC=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0,=20=ED=8C=8C=EC=9D=BC:=EC=A4=84=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20+=20=ED=95=A8=EC=88=98=20=EC=8B=9C=EA=B7=B8?= =?UTF-8?q?=EB=8B=88=EC=B2=98=EB=A7=8C=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 의사코드 제거 (문서 작성 원칙 준수) - 함수 시그니처, 반환 타입만 명시 - 파일명:줄번호 참조 간결화 - 97줄 유지 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../251014_coldmail_ir_analysis_scenario.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/troubleshooting/251014_coldmail_ir_analysis_scenario.md b/troubleshooting/251014_coldmail_ir_analysis_scenario.md index b243f0e..b9591a8 100644 --- a/troubleshooting/251014_coldmail_ir_analysis_scenario.md +++ b/troubleshooting/251014_coldmail_ir_analysis_scenario.md @@ -70,25 +70,24 @@ ### 우선순위 4: LangGraph 워크플로우 - requirements.txt: langgraph 추가 -- app/services/coldmail_email_fetcher.py 생성 (coldmail_briefing.py:93-121 분리, 300줄 제한 준수) - - async def fetch_emails(user_id, start_time, now): skill-email API 호출, return emails -- app/services/coldmail_processor.py 생성 (coldmail_briefing.py:145-202 분리) - - async def process_coldmail(email, user_id): 첨부파일 처리, IR 분석, Slack Lists 생성, return result or None -- app/services/workflows/__init__.py: 빈 파일 생성 -- app/services/workflows/coldmail_workflow.py 생성: - - from typing import TypedDict; from langgraph.graph import StateGraph, END; from app.services import coldmail_email_fetcher, coldmail_processor, coldmail_hybrid_filter - - class ColdmailState(TypedDict): emails: list, coldmail_candidates: list, processed_results: list, user_id: str, start_time: str, now: str - - async def fetch_emails_node(state): emails = await coldmail_email_fetcher.fetch_emails(state["user_id"], state["start_time"], state["now"]), return {"emails": emails} - - async def filter_coldmail_node(state): candidates = [], for email in state["emails"]: result = await coldmail_hybrid_filter.hybrid_coldmail_filter(...), if is_coldmail: candidates.append(email), return {"coldmail_candidates": candidates} - - async def process_email_node(state): results = [], for email in state["coldmail_candidates"]: result = await coldmail_processor.process_coldmail(email, state["user_id"]), if result: results.append(result), return {"processed_results": results} - - async def send_summary_node(state): start_time/now = datetime.fromisoformat(...), async with aiohttp.ClientSession() as session, summary 전송 - - def route_after_filter(state): return "process" if state["coldmail_candidates"] else END - - graph = StateGraph(ColdmailState); graph.add_node/add_edge/add_conditional_edges +- app/services/coldmail_email_fetcher.py 생성 + - coldmail_briefing.py:93-121 로직 분리 + - async def fetch_emails(user_id: str, start_time: str, now: str) -> list +- app/services/coldmail_processor.py 생성 + - coldmail_briefing.py:145-202 로직 분리 + - async def process_coldmail(email: dict, user_id: str) -> dict or None + - 반환: {"company": str, "median": float, "confidence": float, "lower": float, "upper": float, "revenue": str} +- app/services/workflows/__init__.py: 빈 파일 +- app/services/workflows/coldmail_workflow.py 생성 + - class ColdmailState(TypedDict): emails, coldmail_candidates, processed_results, user_id, start_time, now + - 노드: fetch_emails_node, filter_coldmail_node, process_email_node, send_summary_node + - 각 노드는 coldmail_email_fetcher, coldmail_processor, coldmail_hybrid_filter 호출 + - route_after_filter: coldmail_candidates 유무로 분기 + - add_conditional_edges("filter", route_after_filter, {"process": "process", END: END}) - workflow = graph.compile() -- coldmail_briefing.py:78-302 교체 (최종 206줄) - - coldmail_briefing.py:86-101 유지 (now, start_time, user_id 계산) - - from app.services.workflows.coldmail_workflow import workflow - - result = await workflow.ainvoke({"emails": [], "coldmail_candidates": [], "processed_results": [], "user_id": user_id, "start_time": start_time.isoformat(), "now": now.isoformat()}) +- coldmail_briefing.py:78-302 교체 (최종 ~100줄) + - coldmail_briefing.py:86-101 유지 + - workflow.ainvoke(initial_state) 호출 ---