diff --git a/agent-office/app/service_proxy.py b/agent-office/app/service_proxy.py index c55b2d2..e954c70 100644 --- a/agent-office/app/service_proxy.py +++ b/agent-office/app/service_proxy.py @@ -22,7 +22,8 @@ async def summarize_stock_news(limit: int = 15) -> Dict[str, Any]: """stock-lab의 AI 요약 엔드포인트 호출. 반환: {"summary": str, "tokens": {...}, "model": str, "duration_ms": int, "article_count": int} """ - async with httpx.AsyncClient(timeout=90.0) as client: + # stock-lab 내부 Ollama 호출이 180s까지 가능하므로 여유있게 200s + async with httpx.AsyncClient(timeout=200.0) as client: resp = await client.post( f"{STOCK_LAB_URL}/api/stock/news/summarize", json={"limit": limit}, diff --git a/stock-lab/app/ai_summarizer.py b/stock-lab/app/ai_summarizer.py index bacadef..cb9eb84 100644 --- a/stock-lab/app/ai_summarizer.py +++ b/stock-lab/app/ai_summarizer.py @@ -76,11 +76,14 @@ async def summarize_news(articles: List[Dict[str, Any]]) -> Dict[str, Any]: started = time.monotonic() try: - async with httpx.AsyncClient(timeout=60.0) as client: + # qwen3:14b 첫 모델 로드 + 장문 추론은 60s로는 부족 → 180s로 확장 + async with httpx.AsyncClient(timeout=180.0) as client: resp = await client.post(url, json=payload) except httpx.HTTPError as e: - logger.error(f"Ollama 연결 실패 ({url}): {e}") - raise OllamaError(f"Ollama 연결 실패: {e}") from e + err_type = type(e).__name__ + err_msg = str(e) or "(no message)" + logger.error(f"Ollama 연결 실패 ({url}): [{err_type}] {err_msg}") + raise OllamaError(f"Ollama 연결 실패: [{err_type}] {err_msg}") from e if resp.status_code != 200: logger.error(f"Ollama 응답 오류 {resp.status_code}: {resp.text[:200]}")