diff --git a/agent_chat/intent_parser.py b/agent_chat/intent_parser.py index a377e547f..bd99d2b64 100644 --- a/agent_chat/intent_parser.py +++ b/agent_chat/intent_parser.py @@ -139,6 +139,10 @@ class IntentParser: r"de\s+([A-Za-z])\s+à\s+([A-Za-z])", r"(\d+)\s*(?:-|à|to)\s*(\d+)", ], + "expression": [ + # Expressions mathématiques : 5+2, 100*3, 12/4, 7-3, 2.5+3.1 + r"(\d+(?:[.,]\d+)?\s*[+\-*/x×÷]\s*\d+(?:[.,]\d+)?)", + ], } def __init__( diff --git a/data/training/workflows/demo_calculator.json b/data/training/workflows/demo_calculator.json new file mode 100644 index 000000000..087fd44d7 --- /dev/null +++ b/data/training/workflows/demo_calculator.json @@ -0,0 +1,100 @@ +{ + "workflow_id": "demo_calculator", + "name": "Demo - Calculatrice", + "description": "Ouvre la calculatrice et effectue un calcul simple", + "version": "1.0.0", + "created_at": "2024-11-29T10:00:00", + "updated_at": "2024-11-29T10:00:00", + "learning_state": "OBSERVATION", + "execution_count": 0, + "entry_nodes": ["start"], + "end_nodes": ["end"], + "nodes": [ + { + "node_id": "start", + "name": "Desktop", + "description": "Écran de départ", + "template": { + "title_pattern": ".*" + }, + "is_entry": true, + "is_end": false, + "metadata": {} + }, + { + "node_id": "calc_open", + "name": "Calculatrice ouverte", + "description": "La calculatrice est visible", + "template": { + "title_pattern": ".*(calc|gnome-calculator).*" + }, + "is_entry": false, + "is_end": false, + "metadata": {} + }, + { + "node_id": "end", + "name": "Calcul effectué", + "description": "Le calcul est affiché", + "template": { + "title_pattern": ".*" + }, + "is_entry": false, + "is_end": true, + "metadata": {} + } + ], + "edges": [ + { + "edge_id": "open_calc", + "source_node": "start", + "target_node": "calc_open", + "action": { + "type": "compound", + "target": { + "by_role": null, + "selection_policy": "first" + }, + "parameters": { + "steps": [ + {"type": "key_press", "key": "super"}, + {"type": "wait", "duration_ms": 500}, + {"type": "text_input", "text": "calculator"}, + {"type": "key_press", "key": "Return"} + ] + } + }, + "constraints": { + "timeout_ms": 5000 + }, + "confidence_threshold": 0.7 + }, + { + "edge_id": "do_calc", + "source_node": "calc_open", + "target_node": "end", + "action": { + "type": "text_input", + "target": { + "by_role": "button", + "selection_policy": "first" + }, + "parameters": { + "text": "${expression}=", + "defaults": { + "expression": "2+2" + } + } + }, + "constraints": { + "timeout_ms": 3000 + }, + "confidence_threshold": 0.8 + } + ], + "metadata": { + "author": "RPA Vision V3", + "tags": ["demo", "calculator"], + "difficulty": "easy" + } +}