feat: aggiunge pattern detection per 'leggi file'

- Aggiunge pattern per comandi di lettura file
- Estrae automaticamente il path dal messaggio
This commit is contained in:
opencode committed 2026-03-23 18:39:42 +01:00
1 parent cffac60211
commit 9cccbabef1
1 file changed
+14 -1
+14 -1
View File
@@ -354,11 +354,24 @@ For other questions, just answer normally without tools."""
list_patterns = [
'lista', 'listare', 'listami', 'elenco', 'mostrami i file',
'list files', 'list directory', 'ls', 'file nella cartella',
'file del', 'cartella corrente', 'mostra i file'
'file del', 'cartella corrente', 'mostra i file', 'mostrami'
]
if any(p in text_lower for p in list_patterns):
return ToolCall(id='intent', name='ls', arguments={'path': '.'})
# Read file patterns
read_patterns = [
'leggi', 'leggi il file', 'leggere', 'mostrami il contenuto',
'read', 'read file', 'cat', 'apri il file', 'apri'
]
for p in read_patterns:
if p in text_lower:
# Extract path from message
import re
path_match = re.search(r'([/\w.-]+\.\w+)', text)
if path_match:
return ToolCall(id='intent', name='read_file', arguments={'path': path_match.group(1)})
return None
def invoke(self, input_dict: Dict) -> Dict: