Added ability to switch between anthropic and openai on reboot

This commit is contained in:
2024-08-21 17:13:58 -05:00
parent 87a52361ae
commit 37201be1cd
+17 -2
View File
@@ -1,6 +1,7 @@
param( param(
[Parameter(Mandatory=$true)] [Parameter(Mandatory=$true)]
[string]$PythonFile [ValidateSet("Claude", "OpenAI")]
[string]$Model
) )
function Run-PythonScript { function Run-PythonScript {
@@ -19,6 +20,12 @@ function Git-Pull {
return $LASTEXITCODE -eq 0 return $LASTEXITCODE -eq 0
} }
if ($Model -eq "Claude") {
New-Item -ItemType File -Path ".reboot_claude" -Force
} elseif ($Model -eq "OpenAI") {
New-Item -ItemType File -Path ".reboot_openai" -Force
}
$waitTime = 30 $waitTime = 30
while ($true) { while ($true) {
python -m pip install -r requirements.txt python -m pip install -r requirements.txt
@@ -32,8 +39,16 @@ while ($true) {
continue continue
} }
$scriptPath = ".\chatgpt_telegram_inference_bot.py" # Default to ChatGPT
Remove-Item -Path ".\.reboot_openai" -Force
if (Test-Path -Path ".\.reboot_claude") { # But if both are specified, choose Claude
$scriptPath = ".\anthropic_telegram_inference_bot.py"
Remove-Item -Path ".\.reboot_claude" -Force
}
Write-Host "Tests passed. Starting main Python script..." Write-Host "Tests passed. Starting main Python script..."
$exitCode = Run-PythonScript -ScriptPath $PythonFile $exitCode = Run-PythonScript -ScriptPath $scriptPath
if (Test-Path -Path ".\.doreboot") { if (Test-Path -Path ".\.doreboot") {
Write-Host "Special filename detected. Attempting git pull..." Write-Host "Special filename detected. Attempting git pull..."