# Pasang Epithre CLI di Windows. # Jalankan: irm https://docs.isonai.com/downloads/epithre-cli/pasang-epithre-cli.ps1 | iex # API key TIDAK ada di skrip ini; ditanya saat jalan. & { $ErrorActionPreference = "Stop" $AssetUrl = "https://docs.isonai.com/downloads/epithre-cli" $ApiBase = "https://api.epithre.com/v1" $EpiRoot = Join-Path $env:LOCALAPPDATA "epithre" $BinDir = Join-Path $EpiRoot "bin" $CliDir = Join-Path $EpiRoot "cli" $DataDir = Join-Path $env:USERPROFILE ".epithre" $Stamp = Get-Date -Format "yyyyMMdd_HHmmss" function Get-KeyFromSettings([string]$Path) { if (-not (Test-Path $Path)) { return $null } try { $s = Get-Content $Path -Raw | ConvertFrom-Json if ($s.env -and $s.env.EPITHRE_API_KEY) { return [string]$s.env.EPITHRE_API_KEY } } catch { } return $null } Write-Host "" Write-Host " EPITHRE. CLI" -ForegroundColor Cyan Write-Host "" New-Item -ItemType Directory -Force $BinDir, $CliDir, $DataDir | Out-Null # --- 1. Sisa instalasi lama (qwen) --- Write-Host "== 1/5 Cek instalasi lama" -ForegroundColor Cyan $oldHome = Join-Path $env:USERPROFILE ".qwen" $oldEngine = Join-Path $env:LOCALAPPDATA "qwen-code" $oldKey = Get-KeyFromSettings (Join-Path $oldHome "settings.json") if ((Test-Path $oldHome) -or (Test-Path $oldEngine)) { $ans = Read-Host "Instalasi qwen lama ditemukan. Pindahkan ~/.qwen ke backup dan hapus mesin lama? [Y/n]" if ($ans -eq "" -or $ans -match "^[Yy]") { try { if (Test-Path $oldHome) { $bak = Join-Path $DataDir "legacy-qwen-$Stamp" Move-Item $oldHome $bak Write-Host "~/.qwen dipindah ke $bak" } if (Test-Path $oldEngine) { Remove-Item $oldEngine -Recurse -Force Write-Host "Mesin lama dihapus." } } catch { Write-Host "Gagal membersihkan ($($_.Exception.Message)). Tutup semua jendela qwen lalu jalankan pemasang ini lagi." -ForegroundColor Red return } $userPath = [Environment]::GetEnvironmentVariable("Path", "User") if ($userPath) { $kept = @($userPath -split ";" | Where-Object { $_ -ne "" -and $_ -notmatch "\\qwen-code\\" }) [Environment]::SetEnvironmentVariable("Path", ($kept -join ";"), "User") } } } else { Write-Host "Tidak ada." } # --- 2. Berkas Epithre CLI --- Write-Host "== 2/5 Unduh Epithre CLI" -ForegroundColor Cyan $files = @( @{ Name = "epithre.ps1"; Dest = (Join-Path $CliDir "epithre.ps1") }, @{ Name = "epithre.cmd"; Dest = (Join-Path $BinDir "epithre.cmd") }, @{ Name = "logo-large.txt"; Dest = (Join-Path $DataDir "logo-large.txt") }, @{ Name = "logo-small.txt"; Dest = (Join-Path $DataDir "logo-small.txt") } ) foreach ($f in $files) { Invoke-WebRequest -Uri "$AssetUrl/$($f.Name)" -OutFile $f.Dest -UseBasicParsing } # --- 3. Key + settings --- Write-Host "== 3/5 Key Epithre" -ForegroundColor Cyan $settingsPath = Join-Path $DataDir "settings.json" $key = Get-KeyFromSettings $settingsPath if (-not $key) { $key = $oldKey } if ($key) { $ans = Read-Host "Pakai key yang sudah ada (...$($key.Substring([Math]::Max(0, $key.Length - 4))))? [Y/n]" if (-not ($ans -eq "" -or $ans -match "^[Yy]")) { $key = $null } } if (-not $key) { $sec = Read-Host "Tempel API key Epithre (esk_live_...)" -AsSecureString $bstr = [Runtime.InteropServices.Marshal]::SecureStringToBSTR($sec) $key = [Runtime.InteropServices.Marshal]::PtrToStringAuto($bstr).Trim() [Runtime.InteropServices.Marshal]::ZeroFreeBSTR($bstr) } if (-not $key) { Write-Host "Key kosong, batal." -ForegroundColor Red; return } try { $null = Invoke-RestMethod -Uri "$ApiBase/models" -Headers @{ Authorization = "Bearer $key" } -TimeoutSec 20 Write-Host "Key diterima." } catch { Write-Host "Peringatan: key belum bisa dicek ($($_.Exception.Message))." -ForegroundColor Yellow } if (Test-Path $settingsPath) { Copy-Item $settingsPath "$settingsPath.bak-$Stamp" } $json = @" { "env": { "EPITHRE_API_KEY": "$key" }, "modelProviders": { "openai": [ { "id": "epithre-prme", "name": "Epithre PRME (coding, konteks 256K, teks saja)", "baseUrl": "$ApiBase", "envKey": "EPITHRE_API_KEY", "generationConfig": { "contextWindowSize": 262144, "timeout": 300000, "streamIdleTimeoutMs": 600000, "modalities": { "image": false, "video": false, "pdf": false } } }, { "id": "epithre-omni", "name": "Epithre Omni (konteks 128K, bisa gambar)", "baseUrl": "$ApiBase", "envKey": "EPITHRE_API_KEY", "generationConfig": { "contextWindowSize": 131072, "timeout": 120000, "streamIdleTimeoutMs": 600000, "maxRetries": 2, "modalities": { "image": true, "video": false, "pdf": false } }, "capabilities": { "reasoning": { "profile": "qwen-chat-template" } } }, { "id": "epithre-lyt", "name": "Epithre LYT (cepat, konteks 32K, obrolan ringan)", "baseUrl": "$ApiBase", "envKey": "EPITHRE_API_KEY", "generationConfig": { "contextWindowSize": 32768, "timeout": 60000, "modalities": { "image": false, "video": false, "pdf": false } } } ] }, "security": { "auth": { "selectedType": "openai" } }, "ide": { "enabled": false, "hasSeenNudge": true }, "model": { "name": "epithre-prme", "skipNextSpeakerCheck": false }, "general": { "enableAutoUpdate": false, "gitCoAuthor": { "commit": false, "pr": false } }, "review": { "attribution": false }, "privacy": { "usageStatisticsEnabled": false }, "memory": { "enableManagedAutoMemory": false, "enableManagedAutoDream": false }, "context": { "fileName": ["EPITHRE.md"] }, "ui": { "theme": "Epithre", "customThemes": { "Epithre": { "name": "Epithre", "type": "custom", "Background": "#0b1018", "Foreground": "#d6dbe3", "LightBlue": "#9cc0ea", "AccentBlue": "#6f9bd1", "AccentPurple": "#a9b8e8", "AccentCyan": "#8ccfd9", "AccentGreen": "#9fcf8a", "AccentYellow": "#e3c27a", "AccentRed": "#e07a7a", "AccentYellowDim": "#7d6a3f", "AccentRedDim": "#7d3f45", "DiffAdded": "#9fcf8a", "DiffRemoved": "#e07a7a", "Comment": "#6b7686", "Gray": "#3a4454", "GradientColors": ["#c9dbf2", "#5b7fb0"] } }, "customAsciiArt": { "small": { "path": "logo-small.txt" }, "large": { "path": "logo-large.txt" } }, "customBannerTitle": ">_ Epithre CLI", "customBannerSubtitle": "Epithre Platform", "hideTips": true, "hideWindowTitle": true, "brand": { "name": "Epithre CLI" } } } "@ # Tanpa BOM: Node gagal parse JSON ber-BOM. [IO.File]::WriteAllText($settingsPath, $json) Write-Host "Setelan tersimpan: $settingsPath" # --- 4. Mesin --- Write-Host "== 4/5 Pasang mesin (sekali, 1-2 menit)" -ForegroundColor Cyan $epithre = Join-Path $BinDir "epithre.cmd" & $epithre update if (-not (Test-Path (Join-Path $EpiRoot "engine\core\node\node.exe"))) { Write-Host "Mesin gagal terpasang. Log: $DataDir\engine-install.log" -ForegroundColor Red return } # --- 5. PATH --- Write-Host "== 5/5 Daftarkan perintah 'epithre'" -ForegroundColor Cyan $userPath = [Environment]::GetEnvironmentVariable("Path", "User") $entries = @($userPath -split ";" | Where-Object { $_ -ne "" -and $_ -ne $BinDir }) [Environment]::SetEnvironmentVariable("Path", ((@($BinDir) + $entries) -join ";"), "User") $env:Path = "$BinDir;$env:Path" Write-Host "" Write-Host "Tes: siapa kamu?" -ForegroundColor Cyan & $epithre -p "Siapa kamu? Jawab satu kalimat." Write-Host "" & $epithre doctor Write-Host "" Write-Host "Selesai. Buka terminal baru lalu ketik: epithre" -ForegroundColor Green Write-Host "Perintah lain: epithre update | epithre doctor | di dalam: /model" -ForegroundColor Green }