-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·120 lines (101 loc) · 2.86 KB
/
setup.sh
File metadata and controls
executable file
·120 lines (101 loc) · 2.86 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
#!/bin/bash
echo "========================================"
echo "🤖 Asistente de Voz - Setup Fase 0"
echo "========================================"
echo ""
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check macOS
if [[ "$OSTYPE" != "darwin"* ]]; then
echo -e "${RED}❌ Error: Este proyecto requiere macOS${NC}"
exit 1
fi
echo "✓ macOS detected"
# Check Python version
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}')
REQUIRED_VERSION="3.11"
if [[ "$(printf '%s\n' "$REQUIRED_VERSION" "$PYTHON_VERSION" | sort -V | head -n1)" != "$REQUIRED_VERSION" ]]; then
echo -e "${RED}❌ Python 3.11+ required. Found: $PYTHON_VERSION${NC}"
exit 1
fi
echo "✓ Python $PYTHON_VERSION"
# Check if Ollama is installed
echo ""
echo "Checking Ollama..."
if ! command -v ollama &> /dev/null; then
echo -e "${YELLOW}⚠️ Ollama not found. Installing...${NC}"
brew install ollama
else
echo "✓ Ollama installed"
fi
# Check if Ollama is running
if ! curl -s http://localhost:11434/api/tags &> /dev/null; then
echo -e "${YELLOW}⚠️ Ollama not running. Starting...${NC}"
ollama serve > /dev/null 2>&1 &
sleep 3
fi
echo "✓ Ollama running"
# Pull Llama model
echo ""
echo "Checking Llama 3.2 3B model..."
if ! ollama list | grep -q "llama3.2:3b"; then
echo -e "${YELLOW}⚠️ Model not found. Downloading (this may take a few minutes)...${NC}"
ollama pull llama3.2:3b
else
echo "✓ Llama 3.2 3B model available"
fi
# Create virtual environment
echo ""
echo "Setting up Python environment..."
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
else
echo "✓ Virtual environment exists"
fi
# Activate and install dependencies
source venv/bin/activate
echo "Installing dependencies..."
pip install --upgrade pip > /dev/null 2>&1
pip install -r requirements.txt
if [ $? -eq 0 ]; then
echo "✓ Dependencies installed"
else
echo -e "${RED}❌ Error installing dependencies${NC}"
exit 1
fi
# Create necessary directories
echo ""
echo "Creating directories..."
mkdir -p logs/sessions
mkdir -p temp
mkdir -p cache
echo "✓ Directories created"
# Test setup
echo ""
echo "========================================"
echo "🧪 Testing setup..."
echo "========================================"
echo ""
python tests/test_latency.py
if [ $? -eq 0 ]; then
echo ""
echo "========================================"
echo -e "${GREEN}✅ Setup complete!${NC}"
echo "========================================"
echo ""
echo "To start the assistant:"
echo " 1. source venv/bin/activate"
echo " 2. python src/main.py"
echo ""
echo "For guided test:"
echo " python scripts/test_counting.py"
echo ""
else
echo ""
echo -e "${RED}❌ Setup completed with errors${NC}"
echo "Check the output above for details"
fi