diff --git a/troubleshooting/251014_coldmail_ir_analysis_scenario.md b/troubleshooting/251014_coldmail_ir_analysis_scenario.md index ea34eb4..2c6cc24 100644 --- a/troubleshooting/251014_coldmail_ir_analysis_scenario.md +++ b/troubleshooting/251014_coldmail_ir_analysis_scenario.md @@ -72,19 +72,20 @@ - requirements.txt: langgraph 추가 - app/workflows/__init__.py: 빈 파일 생성 - app/workflows/coldmail_workflow.py 생성: - - from typing import TypedDict; from langgraph.graph import StateGraph, END - - class ColdmailState(TypedDict): emails: list, coldmail_candidates: list, processed_results: list, session: object - - async def fetch_emails_node(state): coldmail_briefing.py:93-121 로직 이동 - - async def filter_coldmail_node(state): coldmail_briefing.py:123-141 로직 이동 - - async def process_email_node(state): coldmail_briefing.py:145-287 for 루프 내용 이동 - - async def send_summary_node(state): coldmail_briefing.py:289-300 로직 이동 + - from typing import TypedDict; from langgraph.graph import StateGraph, END; import aiohttp + - class ColdmailState(TypedDict): emails: list, coldmail_candidates: list, processed_results: list + - async def fetch_emails_node(state): async with aiohttp.ClientSession() as session 내부에서 coldmail_briefing.py:103-121 로직 실행, return {"emails": emails} + - async def filter_coldmail_node(state): for email in state["emails"] 반복, coldmail_briefing.py:125-139 필터 로직, return {"coldmail_candidates": candidates} + - async def process_email_node(state): async with aiohttp.ClientSession() as session 내부에서 for email in state["coldmail_candidates"] 반복, coldmail_briefing.py:145-287 처리, try-except로 IR 실패 시 continue, return {"processed_results": results} + - async def send_summary_node(state): async with aiohttp.ClientSession() as session, coldmail_briefing.py:289-300 요약 전송 + - def route_after_filter(state): return "process" if state["coldmail_candidates"] else END - graph = StateGraph(ColdmailState) - graph.add_node("fetch", fetch_emails_node), add_node("filter", filter_coldmail_node), add_node("process", process_email_node), add_node("send", send_summary_node) - - graph.add_edge("fetch", "filter"), add_edge("filter", "process"), add_edge("process", "send"), add_edge("send", END) + - graph.add_edge("fetch", "filter"), add_conditional_edges("filter", route_after_filter, {"process": "process", END: END}), add_edge("process", "send"), add_edge("send", END) - workflow = graph.compile() -- coldmail_briefing.py:78-302: _run_coldmail_briefing() 전체 교체 +- coldmail_briefing.py:78-302: _run_coldmail_briefing() 교체 - from app.workflows.coldmail_workflow import workflow - - initial_state = {"emails": [], "coldmail_candidates": [], "processed_results": [], "session": session} + - initial_state = {"emails": [], "coldmail_candidates": [], "processed_results": []} - result = await workflow.ainvoke(initial_state) ---