-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_nl_rpa.sh
More file actions
executable file
·160 lines (133 loc) · 4.36 KB
/
run_nl_rpa.sh
File metadata and controls
executable file
·160 lines (133 loc) · 4.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/bash
# Natural Language RPA Interface Runner
# ------------------------------
echo "========================================"
echo "Natural Language RPA Interface"
echo "========================================"
# Activate conda environment using the correct path
echo "Activating conda environment..."
source /opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh && conda activate agent_f1_env
# Check if environment activated successfully
if [[ "$CONDA_DEFAULT_ENV" != "agent_f1_env" ]]; then
echo "Warning: Failed to activate agent_f1_env conda environment."
echo "Trying to activate windsurf-mcp environment instead..."
source /opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh && conda activate windsurf-mcp
if [[ "$CONDA_DEFAULT_ENV" != "windsurf-mcp" ]]; then
echo "Error: Failed to activate any required conda environment."
exit 1
fi
fi
echo "Environment activated successfully: $CONDA_DEFAULT_ENV"
# Create necessary directories
mkdir -p output/nl_interface
mkdir -p logs
# Progress indicators
show_progress() {
echo -e "\n🔴 Quality: 85%"
echo "🟢 Speed: 60%"
echo "🔵 Time: 70%"
echo "🟡 Progress: $1%\n"
}
# Check dependencies
echo "Checking dependencies..."
py_deps=("json" "subprocess" "argparse" "logging" "datetime")
missing_deps=0
for dep in "${py_deps[@]}"; do
if ! python -c "import $dep" &> /dev/null; then
echo "Warning: Python package '$dep' not found."
missing_deps=1
fi
done
if [ $missing_deps -eq 1 ]; then
echo "Installing missing dependencies..."
conda install -y -c conda-forge pip
pip install argparse rich
fi
# Check if OLLAMA is installed
if ! command -v ollama &> /dev/null; then
echo "Warning: OLLAMA not found. Will use rule-based parsing instead of LLM."
else
echo "OLLAMA found. Will use local LLM for natural language processing."
# Check if mistral model is available
if ! ollama list | grep -q "mistral"; then
echo "Mistral model not found. Pulling model..."
ollama pull mistral
fi
fi
show_progress 20
# Parse command line arguments
COMMAND=""
INTERACTIVE=false
VERBOSE=false
while [[ $# -gt 0 ]]; do
case $1 in
--command)
COMMAND="$2"
shift 2
;;
--interactive)
INTERACTIVE=true
shift
;;
--verbose)
VERBOSE=true
shift
;;
--help)
echo "Usage: $0 [options]"
echo "Options:"
echo " --command TEXT Natural language command to execute"
echo " --interactive Run in interactive mode"
echo " --verbose Enable verbose output"
echo " --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use --help for usage information"
exit 1
;;
esac
done
show_progress 40
# Set up logging level
LOGGING_ARGS=""
if [ "$VERBOSE" = true ]; then
LOGGING_ARGS="--log-level DEBUG"
echo "Verbose logging enabled"
fi
# Run the natural language interface
if [ -n "$COMMAND" ]; then
echo -e "\nProcessing command: $COMMAND"
show_progress 60
python /Users/yacinebenhamou/Desktop/nl_rpa_interface.py \
--command "$COMMAND" \
$LOGGING_ARGS
RESULT=$?
show_progress 100
if [ $RESULT -eq 0 ]; then
echo -e "\n========================================"
echo "Command executed successfully"
echo "========================================"
else
echo -e "\n========================================"
echo "Command execution failed"
echo "========================================"
echo "Check logs/nl_rpa_interface.log for details"
fi
elif [ "$INTERACTIVE" = true ]; then
echo -e "\nStarting interactive mode..."
show_progress 60
python /Users/yacinebenhamou/Desktop/nl_rpa_interface.py \
--interactive \
$LOGGING_ARGS
show_progress 100
else
echo "No command specified. Use --command or --interactive."
echo "Example commands:"
echo " ./run_nl_rpa.sh --command \"Run OCR detection on the desktop\""
echo " ./run_nl_rpa.sh --interactive"
echo " ./run_nl_rpa.sh --help"
show_progress 100
fi
exit 0