Fix network map not opening from chat/voice

Two issues:
1. NM_OPEN_RE regex was too narrow — phrases like "show me the network",
   "open the network", "show network status" did not match, so they fell
   through to the API which returned text but never opened the map.
   Broadened regex to catch natural network-related phrases.
2. When the network_scan intent IS triggered via API, the map never opened
   because the API response handler only processed reply/arc_job.
   chat.php now returns open_network_map:true for network_scan intent,
   and the client calls openNetMap() when that flag is present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 01:33:31 +00:00
parent 5bbd3a9098
commit 5d12ed6f62
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -1958,4 +1958,5 @@ echo json_encode([
'session_id' => $sessionId,
'timestamp' => date('c'),
'arc_job' => $arcJobId,
'open_network_map' => ($source === 'intent:network_scan'),
]);
+2 -1
View File
@@ -2107,7 +2107,7 @@ var NM_RINGS=[
{name:'devices', label:'DEVICES', rFrac:0.62, speed:-0.002, rgb:'0,160,200', nodeR:14, cap:14 },
{name:'network', label:'NETWORK', rFrac:0.82, speed:0.0015, rgb:'0,110,170', nodeR:11, cap:28 },
];
var NM_OPEN_RE = /\b(show|open|display|launch|pull\s*up|bring\s*up)\b.*\b(network\s*(map|topology|viz|visual|graph)|topology|node\s*map)\b|\bnetwork\s*(map|topology|viz|visual|graph)\b/i;
var NM_OPEN_RE = /\b(show|open|display|launch|pull\s*up|bring\s*up)\b.*\b(network(\s*(map|topology|viz|visual|graph|panel|status|scan|view|overlay))?|topology|node\s*map)\b|\bnetwork\s*(map|topology|viz|visual|graph)\b|\b(show|open|display|launch|pull\s*up|bring\s*up)\s+(?:me\s+)?(?:the\s+)?network\b/i;
var NM_CLOSE_RE = /\b(close|hide|dismiss|exit|collapse)\b.*\b(network|map|topology|overlay)\b|\b(close|hide|dismiss)\s*map\b/i;
function _nmClassify(d){
@@ -3418,6 +3418,7 @@ async function sendMessage() {
addMessage('jarvis', data.reply);
speak(data.reply);
}
if (data.open_network_map) { openNetMap(); }
if (data.arc_job) { onArcJobStarted(data.arc_job, data.source || ''); }
} catch(e) {
const bubble = document.getElementById('thinking-bubble');