-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.ps1
More file actions
83 lines (70 loc) · 2.68 KB
/
setup.ps1
File metadata and controls
83 lines (70 loc) · 2.68 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
param(
[string]$ModelFileName = "gemma-4-E2B-it-Q4_K_M.gguf",
[string]$BackendFolderName = "llama-b8683-win-cpu-x64"
)
$ErrorActionPreference = "Stop"
$projectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$modelsDir = Join-Path $projectRoot "models\gguf"
$dbDir = Join-Path $projectRoot ".db"
$nativeBackendsDir = Join-Path $dbDir "native-backends"
$backendDir = Join-Path $nativeBackendsDir $BackendFolderName
$modelPath = Join-Path $modelsDir $ModelFileName
$cliPath = Join-Path $backendDir "llama-cli.exe"
$exampleSettings = Join-Path $projectRoot "appsettings.example.json"
$appSettings = Join-Path $projectRoot "appsettings.json"
function Write-Section([string]$text) {
Write-Host ""
Write-Host "== $text =="
}
function Write-Step([string]$text) {
Write-Host "[INFO] $text"
}
function Write-Warn([string]$text) {
Write-Host "[WARN] $text"
}
function Write-Ok([string]$text) {
Write-Host "[OK] $text"
}
Write-Section "TinyNotebook setup"
Write-Step "Project root: $projectRoot"
foreach ($dir in @($modelsDir, $dbDir, $nativeBackendsDir, $backendDir)) {
if (-not (Test-Path -LiteralPath $dir)) {
New-Item -ItemType Directory -Path $dir | Out-Null
Write-Ok "Created directory: $dir"
} else {
Write-Step "Directory already exists: $dir"
}
}
if (-not (Test-Path -LiteralPath $appSettings) -and (Test-Path -LiteralPath $exampleSettings)) {
Copy-Item -LiteralPath $exampleSettings -Destination $appSettings
Write-Ok "Created appsettings.json from appsettings.example.json"
}
Write-Section "Model check"
if (Test-Path -LiteralPath $modelPath) {
Write-Ok "Model found: $modelPath"
} else {
Write-Warn "Model not found: $modelPath"
Write-Host "Place your GGUF model here:"
Write-Host " $modelsDir"
Write-Host "Then update appsettings.json / appsettings.web.json if the file name differs."
}
Write-Section "Backend check"
if (Test-Path -LiteralPath $cliPath) {
Write-Ok "llama-cli found: $cliPath"
} else {
Write-Warn "llama-cli.exe not found under: $backendDir"
Write-Host "Expected backend layout:"
Write-Host " $backendDir"
Write-Host "Required file:"
Write-Host " llama-cli.exe"
Write-Host "You can place the llama.cpp Windows CPU build under .db/native-backends/$BackendFolderName"
}
Write-Section "Summary"
Write-Host "Models dir : $modelsDir"
Write-Host "Backend dir: $backendDir"
Write-Host "Settings : $appSettings"
if ((Test-Path -LiteralPath $modelPath) -and (Test-Path -LiteralPath $cliPath)) {
Write-Ok "Setup looks ready. You should be able to build and run TinyNotebook."
} else {
Write-Warn "Setup is incomplete. Add the missing model/backend files, then run this script again."
}