|
|
|
|
|
|
|
|
|
|
|
Write-Host "IITM LLM Quiz Solver - Environment Setup" -ForegroundColor Cyan
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
|
Write-Host ""
|
|
|
|
|
|
|
|
|
$quizSecret = $env:QUIZ_SECRET
|
|
|
$openaiKey = $env:OPENAI_API_KEY
|
|
|
$openrouterKey = $env:OPENROUTER_API_KEY
|
|
|
|
|
|
if ($quizSecret) {
|
|
|
Write-Host "QUIZ_SECRET is already set" -ForegroundColor Green
|
|
|
} else {
|
|
|
Write-Host "QUIZ_SECRET is not set" -ForegroundColor Yellow
|
|
|
$secret = Read-Host "Enter your QUIZ_SECRET (or press Enter to generate one)"
|
|
|
if ([string]::IsNullOrWhiteSpace($secret)) {
|
|
|
|
|
|
$secret = -join ((48..57) + (65..90) + (97..122) | Get-Random -Count 32 | ForEach-Object {[char]$_})
|
|
|
Write-Host "Generated secret: $secret" -ForegroundColor Cyan
|
|
|
}
|
|
|
$env:QUIZ_SECRET = $secret
|
|
|
Write-Host "QUIZ_SECRET set for this session" -ForegroundColor Green
|
|
|
}
|
|
|
|
|
|
if ($openaiKey) {
|
|
|
Write-Host "OPENAI_API_KEY is already set" -ForegroundColor Green
|
|
|
} else {
|
|
|
Write-Host "OPENAI_API_KEY is not set (optional)" -ForegroundColor Yellow
|
|
|
$key = Read-Host "Enter your OPENAI_API_KEY (or press Enter to skip)"
|
|
|
if (-not [string]::IsNullOrWhiteSpace($key)) {
|
|
|
$env:OPENAI_API_KEY = $key
|
|
|
Write-Host "OPENAI_API_KEY set for this session" -ForegroundColor Green
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if ($openrouterKey) {
|
|
|
Write-Host "OPENROUTER_API_KEY is already set" -ForegroundColor Green
|
|
|
} else {
|
|
|
Write-Host "OPENROUTER_API_KEY is not set (optional, e.g., GPT-5-nano)" -ForegroundColor Yellow
|
|
|
$routerKey = Read-Host "Enter your OPENROUTER_API_KEY (or press Enter to skip)"
|
|
|
if (-not [string]::IsNullOrWhiteSpace($routerKey)) {
|
|
|
$env:OPENROUTER_API_KEY = $routerKey
|
|
|
Write-Host "OPENROUTER_API_KEY set for this session" -ForegroundColor Green
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Write-Host ""
|
|
|
Write-Host "Environment variables configured!" -ForegroundColor Green
|
|
|
Write-Host ""
|
|
|
Write-Host "To make these permanent, run:" -ForegroundColor Cyan
|
|
|
Write-Host ('[System.Environment]::SetEnvironmentVariable("QUIZ_SECRET", "' + $env:QUIZ_SECRET + '", "User")') -ForegroundColor Gray
|
|
|
if ($env:OPENAI_API_KEY) {
|
|
|
Write-Host ('[System.Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "' + $env:OPENAI_API_KEY + '", "User")') -ForegroundColor Gray
|
|
|
}
|
|
|
if ($env:OPENROUTER_API_KEY) {
|
|
|
Write-Host ('[System.Environment]::SetEnvironmentVariable("OPENROUTER_API_KEY", "' + $env:OPENROUTER_API_KEY + '", "User")') -ForegroundColor Gray
|
|
|
}
|
|
|
Write-Host ""
|
|
|
Write-Host "Or copy and paste these commands:" -ForegroundColor Cyan
|
|
|
Write-Host ('[System.Environment]::SetEnvironmentVariable("QUIZ_SECRET", "' + $env:QUIZ_SECRET + '", "User")') -ForegroundColor Yellow
|
|
|
if ($env:OPENAI_API_KEY) {
|
|
|
Write-Host ('[System.Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "' + $env:OPENAI_API_KEY + '", "User")') -ForegroundColor Yellow
|
|
|
}
|
|
|
if ($env:OPENROUTER_API_KEY) {
|
|
|
Write-Host ('[System.Environment]::SetEnvironmentVariable("OPENROUTER_API_KEY", "' + $env:OPENROUTER_API_KEY + '", "User")') -ForegroundColor Yellow
|
|
|
}
|
|
|
Write-Host ""
|
|
|
Write-Host "To start the server, run:" -ForegroundColor Cyan
|
|
|
Write-Host "python -m app.main" -ForegroundColor Yellow
|
|
|
|
|
|
|