fix(agent-office): 코드 리뷰 Critical/Important 이슈 수정

- REST 404 응답을 HTTPException으로 변경 (tuple 반환 버그)
- MusicAgent 폴링을 asyncio.create_task로 비동기화 (이벤트 루프 블로킹 해소)
- WebSocket JSON 파싱 에러 핸들링 추가
- StockAgent add_alert 파라미터 검증 추가
- 미사용 의존성 제거 (requests, python-telegram-bot)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-11 09:08:58 +09:00
parent 3a63bfac15
commit 6922217da6
4 changed files with 16 additions and 9 deletions

View File

@@ -45,12 +45,16 @@ class StockAgent(BaseAgent):
return {"ok": True, "message": "뉴스 수집 시작"}
if command == "add_alert":
symbol = params.get("symbol")
target_price = params.get("target_price")
if not symbol or target_price is None:
return {"ok": False, "message": "symbol과 target_price는 필수입니다"}
config = get_agent_config(self.agent_id)
alerts = config["custom_config"].get("alerts", [])
alerts.append({
"symbol": params["symbol"],
"name": params.get("name", params["symbol"]),
"target_price": params["target_price"],
"symbol": symbol,
"name": params.get("name", symbol),
"target_price": target_price,
"direction": params.get("direction", "above"),
})
from ..db import update_agent_config