
# setup-ollama-agents.ps1

param(
    [int]$QwenCtx  = 32768,
    [int]$GemmaCtx = 16384
)

function Create-OllamaModel {
    param(
        [string]$Base,
        [string]$Name,
        [int]$NumCtx,
        [string]$ModelfilePath
    )

    Write-Host "=== Создаём $Name (num_ctx=$NumCtx) ===" -ForegroundColor Cyan

    "FROM $Base`nPARAMETER num_ctx $NumCtx" | Out-File -Encoding utf8 $ModelfilePath

    ollama create $Name -f $ModelfilePath

    if ($LASTEXITCODE -eq 0) {
        Write-Host "OK: $Name создан" -ForegroundColor Green
    } else {
        Write-Host "FAIL: $Name не создан" -ForegroundColor Red
    }

    Remove-Item $ModelfilePath -ErrorAction SilentlyContinue
}

Create-OllamaModel -Base "qwen3.5"  -Name "qwen3.5-agent"  -NumCtx $QwenCtx  -ModelfilePath "Modelfile.qwen"
Create-OllamaModel -Base "gemma4"   -Name "gemma4-agent"   -NumCtx $GemmaCtx -ModelfilePath "Modelfile.gemma"

Write-Host ""
Write-Host "Проверка:" -ForegroundColor Yellow
ollama list | Select-String "agent"