-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
144 lines (128 loc) · 4.53 KB
/
setup.bat
File metadata and controls
144 lines (128 loc) · 4.53 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
@echo off
setlocal enabledelayedexpansion
echo ========================================================
echo Setting up AI Market Research Agent
echo ========================================================
echo.
REM Check if Python is installed
python --version >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
echo [X] Error: Python not found. Please install Python 3.8 or newer.
exit /b 1
)
REM Check Python version
for /f "tokens=2" %%I in ('python --version 2^>^&1') do set PYVER=%%I
for /f "tokens=1,2 delims=." %%A in ("%PYVER%") do (
set PYMAJOR=%%A
set PYMINOR=%%B
)
if "%PYMAJOR%"=="2" (
echo [X] Error: Python 3.8 or higher is required. Found Python %PYVER%
exit /b 1
)
if %PYMAJOR%==3 if %PYMINOR% LSS 8 (
echo [X] Error: Python 3.8 or higher is required. Found Python %PYVER%
exit /b 1
)
echo [✓] Python %PYVER% detected
REM Check if Rust is installed
rustc --version >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
echo [!] Rust not found. Installing Rust...
echo This may take a few minutes...
curl --proto '=https' --tlsv1.2 -sSf https://win.rustup.rs/x86_64 -o rustup-init.exe
rustup-init.exe -y
del rustup-init.exe
set PATH=%USERPROFILE%\.cargo\bin;%PATH%
echo [✓] Rust installation completed
) else (
for /f "tokens=2" %%I in ('rustc --version 2^>^&1') do set RUSTVER=%%I
echo [✓] Rust !RUSTVER! is installed
)
REM Remove existing virtual environment if it exists
if exist .venv (
echo [!] Removing existing virtual environment...
rmdir /s /q .venv
)
REM Create and activate virtual environment
echo [!] Creating Python virtual environment...
python -m venv .venv
call .venv\Scripts\activate
REM Install Python dependencies
echo [!] Installing Python dependencies...
python -m pip install --upgrade pip
pip install -r requirements.txt
REM Make sure key packages are installed
echo [!] Ensuring key packages are installed...
pip install anthropic --upgrade
pip install openai --upgrade
pip install python-dotenv --upgrade
pip install questionary --upgrade
pip install markdown --upgrade
pip install reportlab --upgrade
REM Build and install the Rust backend
echo [!] Building Rust performance backend...
if exist market_research_cli\market_research_core (
cd market_research_cli\market_research_core
REM Check if maturin is installed
pip show maturin >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
echo [!] Installing Maturin build tool...
pip install maturin
)
echo [!] Building Rust library...
maturin build --release
echo [!] Installing Rust library...
pip install target\wheels\market_research_core-*-win_amd64.whl
cd ..\..
echo [✓] Rust backend successfully built and installed
) else (
echo [!] Rust core directory not found, skipping Rust backend build
echo The application will run in Python-only mode with reduced performance
)
REM Create .env file if it doesn't exist
if not exist .env (
echo [!] Creating template .env file...
(
echo # API Keys for AI Market Research Agent
echo # Replace the placeholder values with your actual API keys
echo.
echo # Required: OpenAI API Key (https://platform.openai.com/account/api-keys^)
echo OPENAI_API_KEY=your_openai_api_key_here
echo.
echo # Optional: Anthropic Claude API Key (https://console.anthropic.com/account/keys^)
echo ANTHROPIC_API_KEY=your_claude_api_key_here
echo.
echo # Optional: Brave Search API Key (https://brave.com/search/api/^)
echo BRAVE_API_KEY=your_brave_search_api_key_here
echo.
echo # Optional: Twilio SMS Integration
echo TWILIO_ACCOUNT_SID=your_twilio_account_sid
echo TWILIO_AUTH_TOKEN=your_twilio_auth_token
echo TWILIO_PHONE_NUMBER=your_twilio_phone_number
) > .env
echo [✓] Template .env file created
echo [!] Please edit the .env file with your actual API keys before running the application
) else (
echo [✓] .env file already exists
)
REM Create reports directory if it doesn't exist
if not exist reports (
echo [!] Creating reports directory...
mkdir reports
echo [✓] Reports directory created
) else (
echo [✓] Reports directory already exists
)
echo.
echo ========================================================
echo [✓] Setup Complete!
echo ========================================================
echo.
echo To run the AI Market Research Agent:
echo 1. Edit the .env file with your API keys
echo 2. Run the application with:
echo run.bat
echo.
echo Enjoy generating comprehensive market research reports!
endlocal