forked from enderofwings/NexusOS
feat(ollama): use nexus-core/models as the model store on Windows too
Windows pulled into %USERPROFILE%\.ollama while ncp and doctor looked in nexus-core\models. The installer now sets OLLAMA_MODELS for its pulls and moves an existing default store across first (instant on the same volume, no refetch), and ollama_manager sets OLLAMA_MODELS on every platform. The env block was duplicated in two methods, which is why the carve-out existed twice; folded into _serve_env(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -218,6 +218,31 @@ if ($LASTEXITCODE -ne 0 -or -not $ChatModel -or -not $MemModel) {
|
|||||||
Write-Fail "Could not read the default models from synapse\nexus_config.py - the venv install is broken"
|
Write-Fail "Could not read the default models from synapse\nexus_config.py - the venv install is broken"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Models live in the project's own store on both platforms, so `ncp models list`
|
||||||
|
# and a NexusOS-spawned `ollama serve` agree on where they are. Without this the
|
||||||
|
# installer pulled into %USERPROFILE%\.ollama and NexusOS looked somewhere else.
|
||||||
|
Write-Step "Pointing Ollama at the project model store"
|
||||||
|
$ModelStore = Join-Path $RepoRoot "models"
|
||||||
|
New-Item -ItemType Directory -Path $ModelStore -Force | Out-Null
|
||||||
|
# An existing install has GBs already downloaded in the default store. Move it
|
||||||
|
# rather than make the user fetch it again; on the same volume this is instant.
|
||||||
|
$LegacyStore = Join-Path $env:USERPROFILE ".ollama\models"
|
||||||
|
if ((Test-Path (Join-Path $LegacyStore "blobs")) -and
|
||||||
|
-not (Test-Path (Join-Path $ModelStore "blobs"))) {
|
||||||
|
Write-Host " Moving models from $LegacyStore (no re-download)..." -ForegroundColor DarkGray
|
||||||
|
try {
|
||||||
|
foreach ($sub in @("blobs", "manifests")) {
|
||||||
|
$src = Join-Path $LegacyStore $sub
|
||||||
|
if (Test-Path $src) { Move-Item -Path $src -Destination (Join-Path $ModelStore $sub) -Force }
|
||||||
|
}
|
||||||
|
Write-OK "Existing models moved into $ModelStore"
|
||||||
|
} catch {
|
||||||
|
Write-Warn "Could not move the old model store - the pull below will refetch."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$env:OLLAMA_MODELS = $ModelStore
|
||||||
|
Write-OK "Model store: $ModelStore"
|
||||||
|
|
||||||
Write-Step "Pulling models ($ChatModel for chat, $MemModel for memory)"
|
Write-Step "Pulling models ($ChatModel for chat, $MemModel for memory)"
|
||||||
Write-Host " Downloads a few GB; press Ctrl+C to skip and pull them later from the Models tab." -ForegroundColor DarkGray
|
Write-Host " Downloads a few GB; press Ctrl+C to skip and pull them later from the Models tab." -ForegroundColor DarkGray
|
||||||
# No pipe: 'ollama pull' draws a progress bar with cursor control, and piping it
|
# No pipe: 'ollama pull' draws a progress bar with cursor control, and piping it
|
||||||
|
|||||||
Reference in New Issue
Block a user