-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_cli.ps1
More file actions
46 lines (40 loc) · 1.55 KB
/
Copy pathrun_cli.ps1
File metadata and controls
46 lines (40 loc) · 1.55 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
Write-Host 'BuddAI CLI Launcher' -ForegroundColor Cyan
# Ensure execution happens in the script's directory
Set-Location $PSScriptRoot
# 1. Check Ollama Status
if (Get-Command ollama -ErrorAction SilentlyContinue) {
if (-not (Get-Process ollama* -ErrorAction SilentlyContinue)) {
Write-Host 'Ollama is not running. Starting...' -ForegroundColor Yellow
Start-Process ollama -ArgumentList "serve" -WindowStyle Hidden
Start-Sleep -Seconds 5
} else {
Write-Host 'Ollama is running.' -ForegroundColor Green
}
}
# 2. Check Models
if (Get-Command ollama -ErrorAction SilentlyContinue) {
Write-Host 'Checking AI models...' -ForegroundColor Green
$models = ollama list | Out-String
$required = @('qwen2.5-coder:1.5b', 'qwen2.5-coder:3b')
foreach ($model in $required) {
if ($models -notmatch [regex]::Escape($model)) {
Write-Host "Model '$model' missing. Pulling (this may take a while)..." -ForegroundColor Yellow
ollama pull $model
}
}
}
# 3. Create Virtual Environment if missing
if (-not (Test-Path 'venv')) {
Write-Host 'Creating Python virtual environment...' -ForegroundColor Green
python -m venv venv
}
# 4. Install Dependencies
Write-Host 'Checking dependencies...' -ForegroundColor Green
./venv/Scripts/python.exe -m pip install -r requirements.txt > $null
if ($LASTEXITCODE -ne 0) {
Write-Host "Dependency installation failed." -ForegroundColor Red
exit
}
# 5. Run CLI
Write-Host 'Starting BuddAI CLI...' -ForegroundColor Cyan
./venv/Scripts/python.exe main.py