# ============================================================ # KUL IDEAI - Windows Installer (PowerShell) # https://webstree.com - Webstree AI yerel asistan kurulumu # Usage: irm https://webstree.com/download/ideai-windows.ps1 | iex # ============================================================ #Requires -Version 5.0 $ErrorActionPreference = "Stop" function Write-Banner { Write-Host "" Write-Host " _ __ _ _ _ ___ ____ _____ _ ___" -ForegroundColor Cyan Write-Host " | |/ /| | | | | |_ _| _ \| ____/ \ |_ _|" -ForegroundColor Cyan Write-Host " | ' / | | | | | | || | | | _|/ _ \ | |" -ForegroundColor Cyan Write-Host " | . \ | |_| | |___ | || |_| | |__/ ___ \ | |" -ForegroundColor Cyan Write-Host " |_|\_\ \___/|_____| |___|____/|_____/ \_\___|" -ForegroundColor Cyan Write-Host "" Write-Host " Webstree AI - Yerel yapay zeka asistani" -ForegroundColor DarkGray Write-Host " Qwen3.6:35b + Ollama + Kul fine-tuned" -ForegroundColor DarkGray Write-Host "" } function Write-Log { param($msg) Write-Host "[ideai] $msg" -ForegroundColor Cyan } function Write-Ok { param($msg) Write-Host "[OK] $msg" -ForegroundColor Green } function Write-Warn { param($msg) Write-Host "[!] $msg" -ForegroundColor Yellow } function Write-Err { param($msg) Write-Host "[X] $msg" -ForegroundColor Red } function Install-Ollama { if (Get-Command ollama -ErrorAction SilentlyContinue) { Write-Ok "Ollama zaten kurulu" return } Write-Log "Ollama kuruluyor..." $installerUrl = "https://ollama.com/download/OllamaSetup.exe" $installerPath = "$env:TEMP\OllamaSetup.exe" try { Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath -UseBasicParsing Write-Log "Installer indirildi, calistiliyor (kullanici etkilesimi gerekebilir)..." Start-Process -FilePath $installerPath -Wait Remove-Item $installerPath -Force -ErrorAction SilentlyContinue # PATH refresh $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") Write-Ok "Ollama kuruldu" } catch { Write-Err "Ollama kurulumu basarisiz: $_" exit 1 } } function Start-OllamaService { $proc = Get-Process ollama -ErrorAction SilentlyContinue if ($proc) { Write-Ok "Ollama calisiyor" return } Write-Log "Ollama baslatiliyor..." $ollamaPath = (Get-Command ollama).Source Start-Process -FilePath $ollamaPath -ArgumentList "serve" -WindowStyle Hidden Start-Sleep -Seconds 4 Write-Ok "Ollama aktif" } function Pull-Models { Write-Log "Qwen3.6:35b cekiliyor (~23GB, sure alabilir)..." & ollama pull qwen3.6:35b if ($LASTEXITCODE -eq 0) { Write-Ok "qwen3.6:35b hazir" } else { Write-Err "Model indirilemedi" } Write-Log "Kul fine-tuned model kontrol..." & ollama pull webstree-kul:35b 2>&1 | Out-Null if ($LASTEXITCODE -eq 0) { Write-Ok "webstree-kul:35b hazir (fine-tuned)" } else { Write-Warn "Kul modeli henuz yayinda degil - qwen3.6:35b kullanilacak" } } function Install-IdeaiCli { $binDir = "$env:USERPROFILE\.local\bin" if (-not (Test-Path $binDir)) { New-Item -ItemType Directory -Path $binDir -Force | Out-Null } $cliPath = "$binDir\ideai.ps1" @' param( [Parameter(ValueFromRemainingArguments=$true)] [string[]]$Query ) $model = if ($env:IDEAI_MODEL) { $env:IDEAI_MODEL } else { "webstree-kul:35b" } $list = & ollama list 2>$null if ($list -notmatch $model) { $model = "qwen3.6:35b" } if ($Query) { & ollama run $model ($Query -join ' ') } else { & ollama run $model } '@ | Set-Content -Path $cliPath -Encoding UTF8 # Batch shortcut (cmd.exe uyumlu) $batPath = "$binDir\ideai.bat" @" @echo off powershell -ExecutionPolicy Bypass -File "$cliPath" %* "@ | Set-Content -Path $batPath -Encoding ASCII # PATH'e ekle (user scope) $userPath = [System.Environment]::GetEnvironmentVariable("Path", "User") if ($userPath -notlike "*$binDir*") { [System.Environment]::SetEnvironmentVariable("Path", "$userPath;$binDir", "User") Write-Ok "PATH guncellendi (yeni terminalde aktif olur)" } Write-Ok "IDEAI CLI: $binDir\ideai.bat" } function Install-StartMenu { $shortcutPath = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Kul IDEAI.lnk" $wshShell = New-Object -ComObject WScript.Shell $shortcut = $wshShell.CreateShortcut($shortcutPath) $shortcut.TargetPath = "cmd.exe" $shortcut.Arguments = "/k ""$env:USERPROFILE\.local\bin\ideai.bat""" $shortcut.IconLocation = "powershell.exe" $shortcut.Description = "Webstree AI - Yerel asistan" $shortcut.Save() Write-Ok "Start Menu kisayolu olusturuldu" } function Create-Config { $cfgDir = "$env:APPDATA\ideai" if (-not (Test-Path $cfgDir)) { New-Item -ItemType Directory -Path $cfgDir -Force | Out-Null } $config = @{ version = "1.0.0" model = "webstree-kul:35b" fallback_model = "qwen3.6:35b" ollama_host = "http://127.0.0.1:11434" theme = "dark" primary_color = "#5d00ff" telemetry = $false installed_at = (Get-Date -Format "yyyy-MM-ddTHH:mm:ssZ") platform = "windows" os_version = [System.Environment]::OSVersion.Version.ToString() } | ConvertTo-Json -Depth 10 $config | Set-Content -Path "$cfgDir\config.json" -Encoding UTF8 Write-Ok "Yapilandirma: $cfgDir\config.json" } # ──────── Ana akış ──────── try { Write-Banner Write-Log "Windows $([System.Environment]::OSVersion.Version)" Install-Ollama Start-OllamaService Pull-Models Install-IdeaiCli Install-StartMenu Create-Config Write-Host "" Write-Host "═══════════════════════════════════════════════" -ForegroundColor Green Write-Host " OK Kurulum tamamlandi!" -ForegroundColor Green Write-Host "═══════════════════════════════════════════════" -ForegroundColor Green Write-Host "" Write-Host "Yeni terminal ac veya:" -ForegroundColor White Write-Host " `$env:Path += ';$env:USERPROFILE\.local\bin'" -ForegroundColor Cyan Write-Host "" Write-Host "Kullanim:" -ForegroundColor White Write-Host " ideai - interaktif chat" -ForegroundColor Cyan Write-Host " ideai Merhaba - tek soru" -ForegroundColor Cyan Write-Host " ollama list - yuklu modeller" -ForegroundColor Cyan Write-Host "" Write-Host "https://webstree.com/docs/ideai" -ForegroundColor DarkGray Write-Host "" } catch { Write-Err "Kurulum hatasi: $_" Write-Host $_.ScriptStackTrace -ForegroundColor DarkGray exit 1 }