diff --git a/troubleshooting/251014_coldmail_ir_analysis_scenario.md b/troubleshooting/251014_coldmail_ir_analysis_scenario.md index eeb6052..aefbc45 100644 --- a/troubleshooting/251014_coldmail_ir_analysis_scenario.md +++ b/troubleshooting/251014_coldmail_ir_analysis_scenario.md @@ -41,13 +41,6 @@ --- -## 미구현 및 버그 - -**버그**: LLM JSON 파싱 (ir_analyzer.py:156 마크다운 블록 처리) -**미구현**: 분석 결과 메시지 (coldmail_briefing.py:291) - ---- - ## 분석 결과 예시 (굿베이션) **파일**: 27페이지, 4.7MB → 14 chunks @@ -66,30 +59,38 @@ ### 우선순위 1: Slack Lists 파일 첨부 (✅ 완료) - 상세: 251014_slack_lists_file_attachment.md -- coldmail_briefing.py:191-221, 241: document_id → file_id 변환 완료 +- skill-rag-file/app/api/download.py: GET /api/download/{document_id} +- skill-slack/app/api/endpoints/files.py: POST /files/upload (X-API-Key) +- coldmail_briefing.py:191-221, 241, 246: document_id → file_id 변환 ### 우선순위 2: LLM JSON 파싱 에러 -- ir_analyzer.py:156 전: llm_response 마크다운 블록(```json) 제거 -- strip("```json"), strip("```"), strip() 순차 적용 +- ir_analyzer.py:155 다음 (156 전): llm_response 전처리 + - cleaned = llm_response.strip() + - if cleaned.startswith("```json"): cleaned = cleaned[7:] + - if cleaned.startswith("```"): cleaned = cleaned[3:] + - if cleaned.endswith("```"): cleaned = cleaned[:-3] + - cleaned = cleaned.strip() +- ir_analyzer.py:156: parsed = json.loads(cleaned) -### 우선순위 3: Slack 메시지 포맷 -- coldmail_briefing.py:291: summary_text에 IR 분석 결과 추가 -- ir_metrics (business_area, revenue), valuation_result (median, confidence) 포함 +### 우선순위 3: Slack 메시지에 IR 분석 결과 추가 +- coldmail_briefing.py:144 다음: processed_results = [] 추가 +- coldmail_briefing.py:176 다음: processed_results.append({"company": company_name, "ir": ir_metrics, "valuation": valuation_result}) +- coldmail_briefing.py:291: summary_text 수정 + - 현재: f"콜드메일 {processed_count}건 처리 완료 (...)" + - 변경: for 루프로 각 회사별 밸류에이션, 신뢰도 포함 ### 우선순위 4: LangGraph 워크플로우 -- coldmail_briefing.py → LangGraph 전환 -- 노드: fetch_emails → filter → process_files → analyze_ir → create_list_item → send_feedback -- 조건부 분기: 첨부파일 유무, IR 분석 성공/실패 -- 상태: email_data, document_ids, ir_metrics, valuation_result +- requirements.txt: langgraph, langgraph-checkpoint-postgres 추가 +- app/workflows/coldmail_workflow.py: StateGraph 정의 + - State: TypedDict (emails, coldmail_candidates, processed_results) + - 노드: fetch_emails, filter_coldmail, process_attachments, analyze_ir, create_slack_item, send_summary + - 엣지: fetch → filter → process → analyze → create → send + - 조건부 엣지: process (첨부파일 유무), analyze (성공/실패) +- coldmail_briefing.py:78: _run_coldmail_briefing()에서 workflow.invoke() 호출 --- ## 교훈 -### 전체 시나리오 문서화 중요성 -- 개별 기능은 작동하나 최종 목표 불명확 -- 교훈: 전체 시나리오 문서를 먼저 작성 후 세부 구현 - -### LLM 응답 형식 검증 부족 -- LLM이 마크다운 블록(```json)으로 응답 → JSON 파싱 실패 -- 교훈: LLM 응답은 항상 전처리 필요 +- 전체 시나리오 문서 먼저 작성 후 세부 구현 +- LLM 응답은 항상 전처리 (마크다운 블록 제거)