feat(bot/extension/watcher): Discord 아티팩트 알림 개선 — 파일 첨부 전송, truncation 확대, 동적 .md 감시

This commit is contained in:
Variet Worker
2026-03-13 09:46:56 +09:00
parent 9036f1cefc
commit e5a05e3ac4
10 changed files with 266 additions and 57 deletions

View File

@@ -157,9 +157,10 @@ class GatewayAPI:
data = await request.json()
project = data.get("project_name", "")
content = data.get("content", "")
attached_files = data.get("attached_files", [])
if not project or not content:
return web.json_response({"ok": False, "error": "project_name and content required"}, status=400)
if not project or (not content and not attached_files):
return web.json_response({"ok": False, "error": "project_name and content/attached_files required"}, status=400)
# Write to chat_snapshots dir for bot's scanner
snap_dir = self.bot.bridge.transport.bridge_dir / "chat_snapshots" if hasattr(self.bot.bridge.transport, 'bridge_dir') else None
@@ -172,12 +173,15 @@ class GatewayAPI:
"content": content,
"timestamp": time.time(),
}
if attached_files:
snap_data["attached_files"] = attached_files
(snap_dir / f"{snap_id}.json").write_text(
json.dumps(snap_data, ensure_ascii=False, indent=2),
encoding="utf-8",
)
logger.info(f"[GATEWAY] chat received: project={project} len={len(content)}")
af_info = f" +{len(attached_files)} files" if attached_files else ""
logger.info(f"[GATEWAY] chat received: project={project} len={len(content)}{af_info}")
return web.json_response({"ok": True})
except Exception as e:
logger.error(f"[GATEWAY] chat error: {e}")