feat: add AI学习助手 agent (KG+RAG ideal) and renshenguo feishu bot
- Add AI学习助手 agent creation script with all 39 tools, 3-layer KG+RAG memory - Add renshenguo (人参果) feishu bot integration (app_service + ws_handler) - Register renshenguo WS client in main.py startup - Add RENSHENGUO_APP_ID / RENSHENGUO_APP_SECRET / RENSHENGUO_AGENT_ID config - Reorganize docs from root into docs/ subdirectories - Move startup scripts to scripts/startup/ - Various backend optimizations and tool improvements Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
74
docs/startup-deploy/install_autostart.ps1
Normal file
74
docs/startup-deploy/install_autostart.ps1
Normal file
@@ -0,0 +1,74 @@
|
||||
# Install / uninstall AIAgent auto-start scheduled task
|
||||
# Usage:
|
||||
# powershell -ExecutionPolicy Bypass -File .\install_autostart.ps1
|
||||
# powershell -ExecutionPolicy Bypass -File .\install_autostart.ps1 -Uninstall
|
||||
|
||||
param(
|
||||
[switch]$Uninstall
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$RepoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$TaskName = "AIAgent-Startup"
|
||||
$ScriptPath = Join-Path $RepoRoot "start_aiagent_background.ps1"
|
||||
|
||||
if (-not (Test-Path $ScriptPath)) {
|
||||
Write-Host "ERROR: $ScriptPath not found" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ($Uninstall) {
|
||||
Write-Host "Uninstalling scheduled task: $TaskName ..." -ForegroundColor Yellow
|
||||
Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false -ErrorAction SilentlyContinue
|
||||
Write-Host "[OK] Task '$TaskName' removed" -ForegroundColor Green
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Remove old task if exists
|
||||
Unregister-ScheduledTask -TaskName $TaskName -Confirm:$false -ErrorAction SilentlyContinue
|
||||
|
||||
# Build action: run background start script
|
||||
$argString = "-NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File `"$ScriptPath`""
|
||||
$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument $argString
|
||||
|
||||
# Build trigger: 30 seconds after system boot
|
||||
$trigger = New-ScheduledTaskTrigger -AtStartup -RandomDelay (New-TimeSpan -Seconds 30)
|
||||
|
||||
# Build settings
|
||||
$settings = New-ScheduledTaskSettingsSet `
|
||||
-AllowStartIfOnBatteries `
|
||||
-DontStopIfGoingOnBatteries `
|
||||
-StartWhenAvailable `
|
||||
-RestartCount 3 `
|
||||
-RestartInterval (New-TimeSpan -Minutes 1) `
|
||||
-ExecutionTimeLimit (New-TimeSpan -Minutes 10)
|
||||
|
||||
# Run as SYSTEM (no login required)
|
||||
$principal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest
|
||||
|
||||
Register-ScheduledTask -TaskName $TaskName `
|
||||
-Trigger $trigger `
|
||||
-Action $action `
|
||||
-Settings $settings `
|
||||
-Principal $principal `
|
||||
-Description "AIAgent platform auto-start (Redis + API + Celery + Frontend)" `
|
||||
-Force
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "==================================================" -ForegroundColor Green
|
||||
Write-Host "[OK] Auto-start task installed" -ForegroundColor Green
|
||||
Write-Host "==================================================" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Task name : $TaskName"
|
||||
Write-Host "Trigger : At system startup (30s delay)"
|
||||
Write-Host "Run as : SYSTEM (no login required)"
|
||||
Write-Host "Logs : $RepoRoot\logs\"
|
||||
Write-Host ""
|
||||
Write-Host "Manual test (run now):"
|
||||
Write-Host " Start-ScheduledTask -TaskName '$TaskName'"
|
||||
Write-Host ""
|
||||
Write-Host "Uninstall:"
|
||||
Write-Host " powershell -ExecutionPolicy Bypass -File `"$($MyInvocation.MyCommand.Path)`" -Uninstall"
|
||||
Write-Host ""
|
||||
Write-Host "Verify in GUI:"
|
||||
Write-Host " taskschd.msc -> 任务计划程序库 -> $TaskName"
|
||||
Reference in New Issue
Block a user