-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCORA.bat
More file actions
304 lines (273 loc) · 8.03 KB
/
CORA.bat
File metadata and controls
304 lines (273 loc) · 8.03 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
@echo off
chcp 437 >nul 2>&1
title C.O.R.A - Cognitive Operations & Reasoning Assistant
color 0D
:: Change to the script's directory (handles spaces in path)
cd /d "%~dp0"
:: Find Ollama - check common locations and add to PATH
set "OLLAMA_EXE="
:: Check if already in PATH
where ollama.exe >nul 2>&1
if not errorlevel 1 (
for /f "delims=" %%i in ('where ollama.exe 2^>nul') do set "OLLAMA_EXE=%%i"
goto :found_ollama
)
:: Check common install locations
if exist "%LOCALAPPDATA%\Programs\Ollama\ollama.exe" (
set "OLLAMA_EXE=%LOCALAPPDATA%\Programs\Ollama\ollama.exe"
set "PATH=%LOCALAPPDATA%\Programs\Ollama;%PATH%"
goto :found_ollama
)
if exist "%ProgramFiles%\Ollama\ollama.exe" (
set "OLLAMA_EXE=%ProgramFiles%\Ollama\ollama.exe"
set "PATH=%ProgramFiles%\Ollama;%PATH%"
goto :found_ollama
)
if exist "%ProgramFiles(x86)%\Ollama\ollama.exe" (
set "OLLAMA_EXE=%ProgramFiles(x86)%\Ollama\ollama.exe"
set "PATH=%ProgramFiles(x86)%\Ollama;%PATH%"
goto :found_ollama
)
if exist "%USERPROFILE%\Ollama\ollama.exe" (
set "OLLAMA_EXE=%USERPROFILE%\Ollama\ollama.exe"
set "PATH=%USERPROFILE%\Ollama;%PATH%"
goto :found_ollama
)
:found_ollama
echo.
echo +=========================================+
echo : ____ ___ ____ _ :
echo : / ___]/ _ \[ _ \ / \ :
echo : [ [__ [ [ ] ][ ][_][ o ] :
echo : [ [__ [ [ ] ][ _ / / \ :
echo : \___] \___/[_] [_]_] [_] :
echo : :
echo : Cognitive Operations and Reasoning :
echo : Assistant - v1.0.0 - Unity AI Lab :
echo +=========================================+
echo.
:: Check Python
echo [CHECK] Python...
python --version >nul 2>&1
if errorlevel 1 (
echo [ERROR] Python not found!
echo Please install Python 3.10+ from python.org
pause
exit /b 1
)
for /f "tokens=2" %%i in ('python --version 2^>^&1') do echo Found Python %%i
echo.
:: Check Ollama
echo [CHECK] Ollama...
if "%OLLAMA_EXE%"=="" (
echo [ERROR] Ollama not found!
echo.
echo Please install Ollama from: https://ollama.com
echo.
pause
exit /b 1
)
echo Found: %OLLAMA_EXE%
echo.
:: Check .env file for API keys
:check_env
echo [CHECK] Environment Configuration...
set "ENV_MISSING="
set "POLLINATIONS_OK="
set "GITHUB_OK="
set "WEATHER_OK="
set "NEWS_OK="
if not exist ".env" (
echo.
echo [WARN] .env file not found!
echo Copy env.example to .env and add your API keys.
echo See SETUP.md for instructions.
echo.
set "ENV_MISSING=1"
goto :env_skip_prompt
)
:: Check for Pollinations API key
findstr /i "POLLINATIONS_API_KEY=pk_" ".env" >nul 2>&1
if not errorlevel 1 (
echo Pollinations API - OK
set "POLLINATIONS_OK=1"
) else (
echo [WARN] Pollinations API key missing - image generation disabled
)
:: Check for GitHub token
findstr /i "GITHUB_TOKEN=ghp_" ".env" >nul 2>&1
if not errorlevel 1 (
echo GitHub Token - OK
set "GITHUB_OK=1"
) else (
echo [WARN] GitHub token missing - git operations limited
)
:: Check for Weather API
findstr /i "WEATHER_API_KEY=" ".env" | findstr /v "your_" >nul 2>&1
if not errorlevel 1 (
echo Weather API - OK
set "WEATHER_OK=1"
) else (
echo [WARN] Weather API key missing - weather features disabled
)
:: Check for News API
findstr /i "NEWS_API_KEY=" ".env" | findstr /v "your_" >nul 2>&1
if not errorlevel 1 (
echo News API - OK
set "NEWS_OK=1"
) else (
echo [WARN] News API key missing - news features disabled
)
:env_skip_prompt
if defined ENV_MISSING (
echo.
echo Would you like to:
echo [1] Continue without .env ^(limited features^)
echo [2] Open env.example to set up API keys
echo [3] Exit and set up manually
echo.
set /p ENV_CHOICE=" Enter choice (1-3): "
if "%ENV_CHOICE%"=="2" (
start notepad env.example
echo.
echo After editing, save as .env and press any key to recheck...
pause >nul
goto :check_env
)
if "%ENV_CHOICE%"=="3" (
echo.
echo See SETUP.md and env.example for instructions.
pause
exit /b 0
)
echo.
echo Continuing with limited features...
echo.
)
echo.
:: Check/Pull required models
echo [CHECK] AI Models...
echo.
:: Check dolphin-mistral (main chat model - uncensored, follows instructions)
ollama list | findstr /i "dolphin-mistral" >nul 2>&1
if errorlevel 1 (
echo [DOWNLOAD] dolphin-mistral:7b ^(main chat model - ~4.1GB^)...
echo This is CORA's brain - may take several minutes...
ollama pull dolphin-mistral:7b
if errorlevel 1 (
echo [WARN] Failed to download dolphin-mistral:7b
) else (
echo [OK] dolphin-mistral:7b ready
)
) else (
echo dolphin-mistral - OK
)
:: Check llava (vision model)
ollama list | findstr /i "llava" >nul 2>&1
if errorlevel 1 (
echo [DOWNLOAD] llava ^(vision model - ~4.7GB^)...
echo This may take several minutes...
ollama pull llava
if errorlevel 1 (
echo [WARN] Failed to download llava
) else (
echo [OK] llava ready
)
) else (
echo llava - OK
)
:: Check qwen2.5-coder (coding model - best for 2024)
ollama list | findstr /i "qwen2.5-coder" >nul 2>&1
if errorlevel 1 (
echo [DOWNLOAD] qwen2.5-coder:7b ^(coding model - ~4.4GB^)...
echo This is for code writing/editing...
ollama pull qwen2.5-coder:7b
if errorlevel 1 (
echo [WARN] Failed to download qwen2.5-coder
) else (
echo [OK] qwen2.5-coder ready
)
) else (
echo qwen2.5-coder - OK
)
echo.
:: Check if first run - install Python deps
if not exist "data\.setup_complete" (
echo [SETUP] First run - installing Python dependencies...
echo.
pip install -r requirements.txt
if not exist "data" mkdir data
echo. > data\.setup_complete
echo.
echo [OK] Dependencies installed
echo.
)
:: Always check/install yt-dlp for YouTube functionality
echo [CHECK] yt-dlp (YouTube downloader)...
pip show yt-dlp >nul 2>&1
if errorlevel 1 (
echo Installing yt-dlp...
pip install yt-dlp -q
echo yt-dlp installed
) else (
echo yt-dlp - OK
)
:: Check for mpv (media player for YouTube)
echo [CHECK] mpv media player...
set "MPV_FOUND="
:: First check if mpv is in PATH
where mpv >nul 2>&1
if not errorlevel 1 (
echo mpv - OK ^(in PATH^)
set "MPV_FOUND=1"
goto :mpv_done
)
:: Check if mpv exists anywhere in tools folder (any subfolder structure)
if exist "tools" (
for /r "tools" %%f in (mpv.exe) do (
if exist "%%f" (
echo mpv - OK ^(found: %%~dpf^)
set "PATH=%%~dpf;%PATH%"
set "MPV_FOUND=1"
goto :mpv_done
)
)
)
:: mpv not found anywhere - set flag for Python modal
if not defined MPV_FOUND (
echo [WARN] mpv not found - YouTube playback limited
set "MPV_MISSING=1"
)
:mpv_done
:: Make sure Ollama is running
echo [CHECK] Ollama service...
curl -s http://localhost:11434/api/tags >nul 2>&1
if errorlevel 1 (
echo Starting Ollama service...
start "" /min "%OLLAMA_EXE%" serve
timeout /t 5 /nobreak >nul
:: Verify it started
curl -s http://localhost:11434/api/tags >nul 2>&1
if errorlevel 1 (
echo [WARN] Ollama service may still be starting...
timeout /t 3 /nobreak >nul
)
)
echo Ollama service running
echo.
echo ======================================================
echo.
echo [LAUNCH] Starting C.O.R.A Boot Sequence...
echo.
:: Open Web UI in browser (for split view - terminal + browser side by side)
echo [WEB UI] Opening web interface in browser...
start "" "%~dp0web\index.html"
echo Arrange browser and this terminal side-by-side for split view
echo.
:: Launch boot sequence with dependency status
python src\boot_sequence.py --mpv-missing=%MPV_MISSING%
if errorlevel 1 (
echo.
echo [ERROR] C.O.R.A exited with an error
pause
)