docs: 의사코드 제거, 파일:줄번호 + 함수 시그니처만 명시
- 의사코드 제거 (문서 작성 원칙 준수) - 함수 시그니처, 반환 타입만 명시 - 파일명:줄번호 참조 간결화 - 97줄 유지 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ba38062b6a
commit
81e2e22ac3
@ -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) 호출
|
||||
|
||||
---
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user