feat(agent-office): issue_approve/reject/regen 콜백 처리
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -226,6 +226,38 @@ class InstaAgent(BaseAgent):
|
||||
return {"ok": False}
|
||||
await self._render_and_push(kid)
|
||||
return {"ok": True}
|
||||
if action in ("issue_approve", "issue_reject"):
|
||||
sid = int(params.get("slate_id") or 0)
|
||||
if not sid:
|
||||
return {"ok": False}
|
||||
decision = "approved" if action == "issue_approve" else "rejected"
|
||||
await service_proxy.insta_decision(sid, decision)
|
||||
if decision == "approved":
|
||||
slate = await service_proxy.insta_get_slate(sid)
|
||||
media = []
|
||||
for a in slate["assets"][:10]:
|
||||
data = await service_proxy.insta_get_asset_bytes(sid, a["page_index"])
|
||||
media.append({"type": "photo", "_bytes": data})
|
||||
cap = f"{slate.get('suggested_caption','')}\n\n{' '.join(slate.get('hashtags', []) or [])}".strip()
|
||||
await _send_media_group(media, caption=cap)
|
||||
await messaging.send_raw(f"✅ 발행 완료 (slate {sid})")
|
||||
else:
|
||||
await messaging.send_raw(f"❌ 반려됨 (slate {sid})")
|
||||
return {"ok": True}
|
||||
if action == "issue_regen":
|
||||
sid = int(params.get("slate_id") or 0)
|
||||
if not sid:
|
||||
return {"ok": False}
|
||||
slate = await service_proxy.insta_get_slate(sid)
|
||||
await service_proxy.insta_decision(sid, "rejected")
|
||||
await self._generate_and_preview({
|
||||
"id": 0,
|
||||
"keyword": slate["keyword"],
|
||||
"category": slate["category"],
|
||||
"final_score": None,
|
||||
"breakdown": {},
|
||||
})
|
||||
return {"ok": True}
|
||||
return {"ok": False}
|
||||
|
||||
async def on_approval(self, task_id: str, approved: bool, feedback: str = "") -> None:
|
||||
|
||||
Reference in New Issue
Block a user