Spaces:
Sleeping
Sleeping
Graham Paasch commited on
Commit ·
4363b41
1
Parent(s): 7019a2d
Improve site count parsing and lab telemetry
Browse files- agent/pipeline_engine.py +14 -2
- app.py +12 -0
- mcp-server/build_retail_network.py +4 -0
agent/pipeline_engine.py
CHANGED
|
@@ -250,13 +250,25 @@ class OvergrowthPipeline:
|
|
| 250 |
for word, val in words.items():
|
| 251 |
if f"{word}-site" in text_lower or f"{word} site" in text_lower:
|
| 252 |
return max(1, min(10, val))
|
| 253 |
-
m = re.search(r"(\
|
| 254 |
if m:
|
| 255 |
try:
|
| 256 |
return max(1, min(10, int(m.group(1))))
|
| 257 |
except Exception:
|
| 258 |
pass
|
| 259 |
-
m = re.search(r"(\
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
if m:
|
| 261 |
try:
|
| 262 |
return max(1, min(10, int(m.group(1))))
|
|
|
|
| 250 |
for word, val in words.items():
|
| 251 |
if f"{word}-site" in text_lower or f"{word} site" in text_lower:
|
| 252 |
return max(1, min(10, val))
|
| 253 |
+
m = re.search(r"(\d+)[-\s]?site", text_lower)
|
| 254 |
if m:
|
| 255 |
try:
|
| 256 |
return max(1, min(10, int(m.group(1))))
|
| 257 |
except Exception:
|
| 258 |
pass
|
| 259 |
+
m = re.search(r"(\d+)\s*sites?", text_lower)
|
| 260 |
+
if m:
|
| 261 |
+
try:
|
| 262 |
+
return max(1, min(10, int(m.group(1))))
|
| 263 |
+
except Exception:
|
| 264 |
+
pass
|
| 265 |
+
m = re.search(r"(\d+)\s*(locations?|branches?)", text_lower)
|
| 266 |
+
if m:
|
| 267 |
+
try:
|
| 268 |
+
return max(1, min(10, int(m.group(1))))
|
| 269 |
+
except Exception:
|
| 270 |
+
pass
|
| 271 |
+
m = re.search(r"(\d+)\s*(stores?|shops?)", text_lower)
|
| 272 |
if m:
|
| 273 |
try:
|
| 274 |
return max(1, min(10, int(m.group(1))))
|
app.py
CHANGED
|
@@ -606,6 +606,18 @@ def build_ui():
|
|
| 606 |
missing_sites = []
|
| 607 |
if isinstance(lab_info, dict):
|
| 608 |
missing_sites = lab_info.get("missing_sites") or []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 609 |
build_err = lab_info.get("build_error") or (lab_info.get("build_result") or {}).get("error")
|
| 610 |
if build_err:
|
| 611 |
status += f"- Build error: {build_err}\n"
|
|
|
|
| 606 |
missing_sites = []
|
| 607 |
if isinstance(lab_info, dict):
|
| 608 |
missing_sites = lab_info.get("missing_sites") or []
|
| 609 |
+
requested_sites = lab_info.get("requested_site_count") or results.get("requested_site_count")
|
| 610 |
+
actual_sites = lab_info.get("actual_site_count") or results.get("actual_site_count")
|
| 611 |
+
mismatch = lab_info.get("site_count_mismatch") or results.get("site_count_mismatch")
|
| 612 |
+
if requested_sites:
|
| 613 |
+
status += f"- Requested site count: {requested_sites}\n"
|
| 614 |
+
if actual_sites is not None:
|
| 615 |
+
status += f"- Actual site count: {actual_sites}\n"
|
| 616 |
+
if mismatch:
|
| 617 |
+
status += (
|
| 618 |
+
f"- Site count mismatch: requested {mismatch.get('requested')}, "
|
| 619 |
+
f"actual {mismatch.get('actual')}\n"
|
| 620 |
+
)
|
| 621 |
build_err = lab_info.get("build_error") or (lab_info.get("build_result") or {}).get("error")
|
| 622 |
if build_err:
|
| 623 |
status += f"- Build error: {build_err}\n"
|
mcp-server/build_retail_network.py
CHANGED
|
@@ -8,12 +8,15 @@ an Internet/MPLS cloud. Designed to be driven by the MCP server tool
|
|
| 8 |
"""
|
| 9 |
|
| 10 |
import json
|
|
|
|
| 11 |
import os
|
| 12 |
import time
|
| 13 |
from typing import Any, Dict, List, Optional, Tuple
|
| 14 |
|
| 15 |
import requests
|
| 16 |
|
|
|
|
|
|
|
| 17 |
GNS3_SERVER = os.getenv("GNS3_SERVER", "http://localhost:3080")
|
| 18 |
GNS3_API_BASE = f"{GNS3_SERVER.rstrip('/')}/v2"
|
| 19 |
PROJECT_NAME = os.getenv("GNS3_PROJECT_NAME", "overgrowth")
|
|
@@ -308,6 +311,7 @@ def build_retail_network(
|
|
| 308 |
|
| 309 |
print("\n✅ Retail network build complete")
|
| 310 |
print(f" Requested stores: {site_count} | Built stores: {len(store_clouds)}")
|
|
|
|
| 311 |
return summary
|
| 312 |
|
| 313 |
|
|
|
|
| 8 |
"""
|
| 9 |
|
| 10 |
import json
|
| 11 |
+
import logging
|
| 12 |
import os
|
| 13 |
import time
|
| 14 |
from typing import Any, Dict, List, Optional, Tuple
|
| 15 |
|
| 16 |
import requests
|
| 17 |
|
| 18 |
+
logger = logging.getLogger(__name__)
|
| 19 |
+
|
| 20 |
GNS3_SERVER = os.getenv("GNS3_SERVER", "http://localhost:3080")
|
| 21 |
GNS3_API_BASE = f"{GNS3_SERVER.rstrip('/')}/v2"
|
| 22 |
PROJECT_NAME = os.getenv("GNS3_PROJECT_NAME", "overgrowth")
|
|
|
|
| 311 |
|
| 312 |
print("\n✅ Retail network build complete")
|
| 313 |
print(f" Requested stores: {site_count} | Built stores: {len(store_clouds)}")
|
| 314 |
+
logger.info("Retail builder created %d sites for project %s", len(store_clouds), project_name)
|
| 315 |
return summary
|
| 316 |
|
| 317 |
|