-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_api.sh
More file actions
executable file
·61 lines (49 loc) · 1.83 KB
/
run_api.sh
File metadata and controls
executable file
·61 lines (49 loc) · 1.83 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
#!/bin/bash
# RPA System API Runner
# This script runs the FastAPI backend for the RPA system
# Set up colors for output
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
RED="\033[0;31m"
BLUE="\033[0;34m"
NC="\033[0m" # No Color
echo -e "${BLUE}=========================================${NC}"
echo -e "${BLUE} RPA System API Runner${NC}"
echo -e "${BLUE}=========================================${NC}"
# Activate conda environment
echo -e "${YELLOW}Activating conda environment...${NC}"
source /opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh
conda activate agent_f1_env
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to activate conda environment. Trying fallback...${NC}"
conda activate windsurf-mcp
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to activate any conda environment. Please check your conda installation.${NC}"
exit 1
fi
fi
# Check if required packages are installed
echo -e "${YELLOW}Checking dependencies...${NC}"
# Function to check if a package is installed
check_package() {
python -c "import $1" 2>/dev/null
return $?
}
# Install required packages if not already installed
if ! check_package fastapi || ! check_package uvicorn; then
echo -e "${YELLOW}Installing required packages...${NC}"
pip install -r api/requirements.txt
if [ $? -ne 0 ]; then
echo -e "${RED}Failed to install required packages. Please check your pip installation.${NC}"
exit 1
fi
fi
# Create output directory if it doesn't exist
mkdir -p output/integrated
# Run the API
echo -e "${GREEN}Starting RPA System API...${NC}"
echo -e "${GREEN}API will be available at http://localhost:8000${NC}"
echo -e "${GREEN}API documentation will be available at http://localhost:8000/docs${NC}"
echo -e "${YELLOW}Press Ctrl+C to stop the API${NC}"
cd api
uvicorn main:app --reload --host 0.0.0.0 --port 8000