SysOps: deploy-all — 2026-06-09 10:41 UTC
This commit is contained in:
@@ -5,6 +5,7 @@ import httpx
|
||||
from app.config import settings
|
||||
from app.db import execute, fetch_one
|
||||
from app.services import ollama
|
||||
from app.services import packaging_agent
|
||||
|
||||
AGENTS: dict[str, dict[str, str]] = {
|
||||
"marketing": {"name": "Marketing", "persona": "Social, brand voice, campaigns for Foodlinkk."},
|
||||
@@ -14,6 +15,7 @@ AGENTS: dict[str, dict[str, str]] = {
|
||||
"product": {"name": "Product", "persona": "SKU development, launch timelines, shelf readiness."},
|
||||
"halal": {"name": "Halal", "persona": "Halal compliance, certification, ingredient vetting."},
|
||||
"design": {"name": "Design", "persona": "Packaging, visual identity, retail presentation."},
|
||||
"packaging": {"name": "Packaging", "persona": "SVG/PDF verpakkingsontwerp, stanstekeningen, drukwerk."},
|
||||
"knowledge": {"name": "Knowledge", "persona": "Internal docs, RAG, policy answers."},
|
||||
}
|
||||
|
||||
@@ -82,6 +84,72 @@ def _pick_agent(raw: str) -> str:
|
||||
return "knowledge"
|
||||
|
||||
async def chat(message: str) -> dict[str, Any]:
|
||||
if packaging_agent.wants_packaging(message):
|
||||
try:
|
||||
outcome = await packaging_agent.generate_from_message(message)
|
||||
name = outcome.get("design_name") or "Design"
|
||||
pid = outcome.get("packaging_id", "")[:8]
|
||||
reply_lines = [
|
||||
f"Packaging agent heeft een design klaar voor je: {name}",
|
||||
f"Type: {outcome.get('type')} · {outcome.get('dimensions')}",
|
||||
f"Project #{outcome.get('cockpit_project_id')}",
|
||||
f"Studio: {outcome.get('studio_url')}",
|
||||
f"PDF: {outcome.get('pdf_url')}",
|
||||
]
|
||||
if outcome.get("nas", {}).get("ok"):
|
||||
reply_lines.append("Bestanden staan op de NAS in de packaging-map van het project.")
|
||||
reply = "\n".join(reply_lines)
|
||||
|
||||
await _log_event(
|
||||
"packaging",
|
||||
"packaging_created",
|
||||
f"Design klaar: {name}",
|
||||
f"Herman-opdracht: {message[:1500]}\n\nDesign-ID: {outcome.get('packaging_id')}",
|
||||
{
|
||||
"packaging_id": outcome.get("packaging_id"),
|
||||
"project_id": outcome.get("cockpit_project_id"),
|
||||
"studio_url": outcome.get("studio_url"),
|
||||
"pdf_url": outcome.get("pdf_url"),
|
||||
"nas": outcome.get("nas"),
|
||||
"for_herman": True,
|
||||
},
|
||||
)
|
||||
await _log_event(
|
||||
"herman",
|
||||
"packaging_delivered",
|
||||
f"Packaging → Herman: {name}",
|
||||
reply[:2000],
|
||||
{
|
||||
"source_agent": "packaging",
|
||||
"packaging_id": outcome.get("packaging_id"),
|
||||
"project_id": outcome.get("cockpit_project_id"),
|
||||
},
|
||||
)
|
||||
return {
|
||||
"agent": "packaging",
|
||||
"agent_label": "Packaging → Herman",
|
||||
"reply": reply,
|
||||
"delegated_agents": ["packaging", "herman"],
|
||||
"routing_reason": "Packaging-opdracht gedetecteerd — design gegenereerd en aan Herman gerapporteerd",
|
||||
"packaging_id": outcome.get("packaging_id"),
|
||||
"packaging_studio_url": outcome.get("studio_url"),
|
||||
"packaging_pdf_url": outcome.get("pdf_url"),
|
||||
}
|
||||
except Exception as exc:
|
||||
await _log_event(
|
||||
"packaging",
|
||||
"packaging_error",
|
||||
"Packaging generatie mislukt",
|
||||
str(exc)[:1500],
|
||||
{"message": message[:500]},
|
||||
)
|
||||
return {
|
||||
"agent": "packaging",
|
||||
"agent_label": "Packaging",
|
||||
"reply": f"Packaging agent kon geen design maken: {exc}",
|
||||
"delegated_agents": ["packaging"],
|
||||
}
|
||||
|
||||
if _wants_image(message):
|
||||
prompt = _extract_image_prompt(message)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user