feat: aggiunge pattern per comando 'cerca file'
This commit is contained in:
1 parent
1e49eff703
commit
f8ebfb65ab
1 file changed
+14
@@ -367,6 +367,20 @@ For other questions, just answer normally without tools."""
|
||||
if any(p in text_lower for p in list_patterns):
|
||||
return ToolCall(id='intent', name='ls', arguments={'path': '.'})
|
||||
|
||||
# Search patterns
|
||||
search_patterns = [
|
||||
'cerca', 'cercare', 'trova', 'trovare', 'dove si trova',
|
||||
'search', 'find', 'file', '*.py', '*.md', '*.txt'
|
||||
]
|
||||
# If the message mentions file patterns, use search tool
|
||||
if 'cerca' in text_lower or 'search' in text_lower or 'find' in text_lower:
|
||||
# Extract directory and pattern
|
||||
dir_match = re.search(r'(?:in|alla|nella)\s+([/\w.-]+)', text)
|
||||
pattern_match = re.search(r'\*\.(\w+)', text)
|
||||
directory = dir_match.group(1) if dir_match else '.'
|
||||
pattern = f"*.{pattern_match.group(1)}" if pattern_match else "*"
|
||||
return ToolCall(id='intent', name='search', arguments={'directory': directory, 'pattern': pattern})
|
||||
|
||||
# Read/show file patterns - check for ANY read keyword AND a file path
|
||||
read_keywords = ['leggi', 'leggere', 'mostrami', 'apri', 'aprimi', 'visualizza',
|
||||
'vediamo', 'vedi', 'show me', 'show the', 'read', 'open',
|
||||
|
||||
Reference in new issue
Block a user