diff --git a/ops/work/web/services/svc_draw.py b/ops/work/web/services/svc_draw.py
index ad85e49..75bc743 100644
--- a/ops/work/web/services/svc_draw.py
+++ b/ops/work/web/services/svc_draw.py
@@ -144,9 +144,127 @@ def ipplan(q, body):
return {"base": base, "rows": rows, "count": len(rows)}
+def _room(q):
+ try:
+ w = float((q.get("w") or ["8"])[0])
+ l = float((q.get("l") or ["10"])[0])
+ except ValueError:
+ w, l = 8.0, 10.0
+ return max(3.0, min(40.0, w)), max(3.0, min(60.0, l))
+
+
+def layout(q, body):
+ """План комнаты сверху: хост, микрофоны на столе, камера у стены, дисплей."""
+ w, l = _room(q)
+ items = _items(q)
+ scale = 60 # px на метр
+ W = int(w * scale) + 120
+ H = int(l * scale) + 120
+ ox, oy = 60, 60
+ parts = [f'")
+ return {"svg": "".join(parts), "width_m": w, "length_m": l,
+ "area_m2": round(w * l, 1)}
+
+
+def heatmap(q, body):
+ """Тепловая карта покрытия: микрофоны (радиус захвата) и камера (FOV)."""
+ w, l = _room(q)
+ items = _items(q)
+ scale = 45
+ W = int(w * scale) + 120
+ H = int(l * scale) + 120
+ ox, oy = 60, 60
+ parts = [f'")
+ return {"svg": "".join(parts), "mics": total, "cams": len(cams)}
+
+
serve({
"/diagram": diagram,
"/cables": cables,
"/rack": rack,
"/ipplan": ipplan,
+ "/layout": layout,
+ "/heatmap": heatmap,
}, int(sys.argv[1]) if len(sys.argv) > 1 else 8104, "draw")
diff --git a/ops/work/web/services/svc_engine.py b/ops/work/web/services/svc_engine.py
index adb71b0..c458bf6 100644
--- a/ops/work/web/services/svc_engine.py
+++ b/ops/work/web/services/svc_engine.py
@@ -395,6 +395,65 @@ def ask(q, body):
"llm": bool(answer and "qwen" )}
+def spec(q, body):
+ """Спецификация проекта без цен: состав, кабели, проверки, комплектация."""
+ host = (q.get("host") or [""])[0]
+ seats = int((q.get("seats") or ["8"])[0])
+ items = _items(q)
+ if not items:
+ b = bom(q, body)
+ if b.get("error"):
+ return b
+ items = [[x["model"], x["qty"]] for x in b["bom"]
+ if not x["model"].startswith(("встроенный", "внешний"))]
+ hostname = C.devices.get(cc.norm(host), {}).get("name") or host
+ cab = C.cable_schedule(host, items)
+ cap = C.capacity(host, items, q.get("infra") or [])
+ sig = C.signal_chains(host, items)
+ rev = review({"host": [host], "item": ["%s:%d" % (i[0], i[1]) for i in items]}, None)
+
+ def row(*cells):
+ return "
" + "".join("| %s | " % c for c in cells) + "
"
+
+ h = ["Спецификация",
+ "",
+ "Спецификация оборудования
",
+ "Комплекс: %s · мест: %d · режим: без цен
" % (hostname, seats),
+ "1. Состав
| № | Модель | Кол |
"]
+ for i, r in enumerate(items, 1):
+ h.append(row(str(i), r[0], str(r[1])))
+ h.append("
2. Кабельный журнал
"
+ "| От | Порт | К | Порт | Тип | Примечание |
")
+ for c in cab["cables"]:
+ h.append(row(c["from"], c["from_port"], c["to"], c["to_port"], c["type"],
+ c.get("note") or ""))
+ h.append("
3. Проверки
| Проверка | Результат |
")
+ h.append(row("порты VCH", "%s у хоста, %s устройств" % (cap["vch_ports"], cap["vch_users"])))
+ h.append(row("порты коммутаторов", "%s (каскад, коммутаторов %s)"
+ % (cap["extra_ports"], cap["n_switches"])))
+ h.append(row("питание", "%.1f Вт потребление · %.1f Вт доп. бюджет"
+ % (cap["total_power_w"], cap["extra_budget_w"])))
+ h.append(row("сигнальные цепочки", "%s из %s корректны" % (sig["ok"], sig["total"])))
+ for i in cap["issues"]:
+ h.append(row("проблема", "%s" % i))
+ h.append("
4. Комплектация
| Устройство | В комплекте |
")
+ for r in items:
+ p = C.package(r[0])
+ if p["items"]:
+ h.append(row(r[0], " · ".join(p["items"])))
+ h.append("
5. Ревью
| Готовность | Значение |
")
+ h.append(row("блокеров", str(rev["blockers"])))
+ h.append(row("предупреждений", str(rev["warnings"])))
+ h.append(row("готов к закупке", "да" if rev["ready"] else "нет"))
+ h.append("
")
+ html = "".join(h)
+ return {"__file__": html.encode(), "filename": "spec-%s.html" % cc.norm(hostname)[:18],
+ "content_type": "text/html; charset=utf-8"}
+
+
serve({
"/groups": groups,
"/check": check,
@@ -410,5 +469,6 @@ serve({
"/review": review,
"/vendors": vendors,
"/ask": ask,
+ "/spec": spec,
"/xlsx": xlsx,
}, int(sys.argv[1]) if len(sys.argv) > 1 else 8102, "engine")
diff --git a/ops/work/web/smoke_services.py b/ops/work/web/smoke_services.py
new file mode 100644
index 0000000..2059415
--- /dev/null
+++ b/ops/work/web/smoke_services.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+"""Смоук-тесты сервисов комбайна: все эндпойнты отвечают и данные не пустые."""
+import json
+import sys
+import urllib.request
+
+SVC = {
+ "catalog": "http://127.0.0.1:8101",
+ "engine": "http://127.0.0.1:8102",
+ "project": "http://127.0.0.1:8103",
+ "draw": "http://127.0.0.1:8104",
+ "docs": "http://127.0.0.1:8105",
+}
+HOST = "meetingbara50"
+ITEMS = "item=UVC86&item=CTP25&item=MeetingDisplay"
+
+
+def get(url, timeout=60):
+ with urllib.request.urlopen(url, timeout=timeout) as r:
+ return r.status, r.read()
+
+
+CHECKS = [
+ ("catalog", "/hosts", lambda b: len(json.loads(b).get("hosts") or []) > 10),
+ ("catalog", "/matrix", lambda b: len(json.loads(b).get("rows") or []) > 10),
+ ("catalog", "/vendors", lambda b: len(json.loads(b).get("vendors") or []) >= 1),
+ ("catalog", "/port-objects?name=UVC86", lambda b: len(json.loads(b).get("ports") or []) > 0),
+ ("engine", "/groups?host=%s" % HOST, lambda b: len(json.loads(b).get("groups") or []) > 3),
+ ("engine", "/autofill?host=%s&seats=10" % HOST,
+ lambda b: len(json.loads(b).get("items") or []) >= 3),
+ ("engine", "/checklist?host=%s&%s" % (HOST, ITEMS),
+ lambda b: json.loads(b).get("total", 0) >= 5),
+ ("engine", "/signals?host=%s&%s" % (HOST, ITEMS),
+ lambda b: json.loads(b).get("total", 0) >= 1),
+ ("engine", "/cables?host=%s&%s" % (HOST, ITEMS),
+ lambda b: "cables" in json.loads(b)),
+ ("engine", "/ports?host=%s&%s" % (HOST, ITEMS),
+ lambda b: "free_in" in json.loads(b)),
+ ("engine", "/capacity?host=%s&%s" % (HOST, ITEMS),
+ lambda b: "vch_ports" in json.loads(b)),
+ ("engine", "/review?host=%s&%s" % (HOST, ITEMS),
+ lambda b: "issues" in json.loads(b)),
+ ("engine", "/check?host=meetingeye500&device=VCM36-W",
+ lambda b: json.loads(b).get("supported") is False),
+ ("engine", "/accessory?device=WPP30",
+ lambda b: json.loads(b).get("count", 0) > 5),
+ ("engine", "/bom?host=%s&seats=10" % HOST, lambda b: len(json.loads(b).get("bom") or []) > 2),
+ ("engine", "/xlsx?host=%s&seats=10" % HOST, lambda b: len(b) > 3000),
+ ("engine", "/spec?host=%s&seats=10" % HOST, lambda b: len(b) > 500),
+ ("engine", "/ask?q=MeetingEye+500+%2B+VCM38", lambda b: bool(json.loads(b).get("answer"))),
+ ("project", "/list", lambda b: "projects" in json.loads(b)),
+ ("draw", "/diagram?host=%s&%s" % (HOST, ITEMS),
+ lambda b: b"