vasanthfeb13 commited on
Commit
281222a
·
1 Parent(s): 244c57f

Fix: Support directory/folder aliases in AI navigation and refine regex

Browse files
Files changed (1) hide show
  1. src/nacc_orchestrator/server.py +10 -3
src/nacc_orchestrator/server.py CHANGED
@@ -575,10 +575,17 @@ connect to 473293 at 192.168.1.50 and name it as vasanth-laptop
575
 
576
  # Try to extract path from query FIRST (prioritize explicit path)
577
  target_dir = None
 
 
 
 
 
578
  # Use original query for regex to preserve case
579
- path_match = re.search(r'(?:cd|go to|navigate to)\s+([\w/~.-]+)', payload.query, re.IGNORECASE)
580
- if path_match:
581
- target_dir = path_match.group(1)
 
 
582
  # Handle relative paths
583
  if not target_dir.startswith('/') and not target_dir.startswith('~'):
584
  import os
 
575
 
576
  # Try to extract path from query FIRST (prioritize explicit path)
577
  target_dir = None
578
+
579
+ # If AI provided parameters, use them (support aliases)
580
+ if tool_name == "change_directory" and parameters:
581
+ target_dir = parameters.get("path") or parameters.get("directory") or parameters.get("folder")
582
+
583
  # Use original query for regex to preserve case
584
+ if not target_dir:
585
+ # Refined regex to ignore "the" and capture path
586
+ path_match = re.search(r'(?:cd|go to|navigate to)\s+(?:the\s+)?(?:directory|folder\s+)?([\w/~.-]+)', payload.query, re.IGNORECASE)
587
+ if path_match:
588
+ target_dir = path_match.group(1)
589
  # Handle relative paths
590
  if not target_dir.startswith('/') and not target_dir.startswith('~'):
591
  import os