diff --git a/ollama_agent.py b/ollama_agent.py index 561aa58..a8cee5d 100644 --- a/ollama_agent.py +++ b/ollama_agent.py @@ -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: