Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions AUTORUN_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Install and autorun for text-generation-webui (Windows)

This folder contains helper scripts to install the web UI as an autorun service on your Windows user account.

Files:
- `start_webui_minimized.ps1` — PowerShell script that launches the web UI server using the venv Python; starts minimized.
- `install_autostart.bat` — Creates a shortcut in your Windows Startup folder to run the PowerShell script at login.

How to install (one-time):
1. Double-click `install_autostart.bat` and allow it to run. This will create a shortcut named `TextGenWebUI.lnk` in your Startup folder.
2. The next time you log into Windows, the web UI will start automatically minimized using the project's venv.

Start now (manual):
- To start immediately without waiting for login, run the PowerShell script manually (right-click and select "Run with PowerShell") or run:
powershell -NoProfile -ExecutionPolicy Bypass -File "start_webui_minimized.ps1"

Stop/remove autorun:
- Delete `TextGenWebUI.lnk` from your Startup folder. You can open the Startup folder with:
explorer.exe shell:startup

Notes & troubleshooting:
- The scripts assume the project is at `D:\AI_ML_Development\text-generation-webui` and the venv exists at `venv` inside the project. If you move the project, edit `start_webui_minimized.ps1`.
- Ensure your PowerShell ExecutionPolicy allows running scripts. `install_autostart.bat` sets `-ExecutionPolicy Bypass` when launching the script.
- Logs: by default the script starts the server without redirecting output. To capture logs, edit `start_webui_minimized.ps1` and use the `-RedirectStandardOutput` / `-RedirectStandardError` options (commented in file).
40 changes: 40 additions & 0 deletions clone_merwel_repos.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Clone or update all repositories for MerwelLabs into the specified destination
$dest = 'D:\OneDrive_Merwel\OneDrive\Github'
$gh = 'C:\Program Files\GitHub CLI\gh.exe'
Comment on lines +2 to +3
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded paths are duplicated across scripts. Consider centralizing these configuration values in a shared configuration file or variables to avoid maintenance issues.

Copilot uses AI. Check for mistakes.

if (!(Test-Path $gh)) {
Write-Error "gh not found at $gh. Ensure GitHub CLI is installed and on PATH."
exit 1
}

New-Item -ItemType Directory -Path $dest -Force | Out-Null

Write-Output "Listing repositories for MerwelLabs..."
$reposJson = & $gh repo list MerwelLabs --limit 1000 --json name,sshUrl,visibility
if (-not $reposJson) {
Write-Output "No repos found or gh returned nothing."
exit 0
}

$repos = $reposJson | ConvertFrom-Json

foreach ($r in $repos) {
$dir = Join-Path $dest $r.name
if (Test-Path $dir) {
Write-Output "Updating $($r.name)..."
try {
git -C $dir pull --rebase
} catch {
Write-Warning "Failed to pull $($r.name): $_"
}
} else {
Write-Output "Cloning $($r.name)..."
try {
git clone $r.sshUrl $dir
} catch {
Write-Warning "Failed to clone $($r.name): $_"
}
}
}

Write-Output "Done. Repositories are in: $dest"
8 changes: 8 additions & 0 deletions install_autostart.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off
REM Creates a shortcut in the current user's Startup folder to run the web UI minimized at login.
set SCRIPT_PATH=%~dp0start_webui_minimized.ps1
necho Creating startup shortcut...
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the echo command - 'necho' should be 'echo'.

Suggested change
necho Creating startup shortcut...
echo Creating startup shortcut...

Copilot uses AI. Check for mistakes.
powershell -NoProfile -ExecutionPolicy Bypass -Command "$WshShell = New-Object -ComObject WScript.Shell; $startup = [Environment]::GetFolderPath('Startup'); $sc = $WshShell.CreateShortcut((Join-Path $startup 'TextGenWebUI.lnk')); $sc.TargetPath = 'powershell.exe'; $sc.Arguments = '-NoProfile -ExecutionPolicy Bypass -File "' + '%SCRIPT_PATH%' + '"'; $sc.IconLocation = '%~dp0venv\Scripts\python.exe'; $sc.WindowStyle = 7; $sc.Save()"
echo Shortcut created in your Startup folder.
echo To remove it, delete the file 'TextGenWebUI.lnk' from the Startup folder.
pause
14 changes: 14 additions & 0 deletions start_webui_minimized.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Start text-generation-webui in the project's venv, minimized.
# Created by automation. To edit, update this file in the project folder.

$ProjectPath = 'D:\AI_ML_Development\text-generation-webui'
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded project path reduces portability. Consider making this configurable through environment variables or command-line parameters.

Suggested change
$ProjectPath = 'D:\AI_ML_Development\text-generation-webui'
# Allow project path to be set via environment variable or command-line argument.
if ($env:TEXTGEN_PROJECT_PATH) {
$ProjectPath = $env:TEXTGEN_PROJECT_PATH
} elseif ($args.Count -ge 1) {
$ProjectPath = $args[0]
} else {
$ProjectPath = 'D:\AI_ML_Development\text-generation-webui'
}

Copilot uses AI. Check for mistakes.
$Python = Join-Path $ProjectPath 'venv\Scripts\python.exe'

# Launch the server in portable mode with API enabled.
# Use Minimized window style so the console doesn't pop up.
Start-Process -FilePath $Python -ArgumentList 'server.py','--portable','--api' -WorkingDirectory $ProjectPath -WindowStyle Minimized

# Optional: redirect output to a log file instead of showing console.
# To enable logging, uncomment the following lines and edit the log path.
# $log = Join-Path $ProjectPath 'autorun.log'
# Start-Process -FilePath $Python -ArgumentList 'server.py','--portable','--api' -WorkingDirectory $ProjectPath -WindowStyle Minimized -RedirectStandardOutput $log -RedirectStandardError $log
57 changes: 57 additions & 0 deletions sync_merwel_repos.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<#
PowerShell script to sync MerwelLabs GitHub repositories into the OneDrive folder.
Writes logs to D:\OneDrive_Merwel\OneDrive\Github\sync_logs and keeps the last 30 logs.
#>

$dest = 'D:\OneDrive_Merwel\OneDrive\Github'
$gh = 'C:\Program Files\GitHub CLI\gh.exe'
Copy link

Copilot AI Sep 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded paths reduce portability. Consider using environment variables or configuration parameters to make these paths configurable.

Suggested change
$gh = 'C:\Program Files\GitHub CLI\gh.exe'
# Allow override of GitHub CLI path via environment variable GH_PATH
$gh = if ($env:GH_PATH) { $env:GH_PATH } else { 'C:\Program Files\GitHub CLI\gh.exe' }

Copilot uses AI. Check for mistakes.
$logDir = Join-Path $dest 'sync_logs'
New-Item -ItemType Directory -Path $logDir -Force | Out-Null

$timestamp = (Get-Date).ToString('yyyy-MM-dd_HHmmss')
$logFile = Join-Path $logDir "sync_$timestamp.log"

Start-Transcript -Path $logFile -Force

Write-Output "=== MerwelLabs repo sync started: $(Get-Date -Format o) ==="

if (!(Test-Path $gh)) {
Write-Error "gh not found at $gh. Exiting."
Stop-Transcript
exit 1
}

Write-Output "Listing repositories for MerwelLabs..."
$reposJson = & $gh repo list MerwelLabs --limit 1000 --json name,sshUrl,visibility
if (-not $reposJson) {
Write-Output "No repos found or gh returned nothing."
Stop-Transcript
exit 0
}

$repos = $reposJson | ConvertFrom-Json

foreach ($r in $repos) {
$dir = Join-Path $dest $r.name
if (Test-Path $dir) {
Write-Output "Updating $($r.name)..."
try {
git -C $dir pull --rebase 2>&1 | ForEach-Object { Write-Output $_ }
} catch {
Write-Warning "Failed to pull $($r.name): $_"
}
} else {
Write-Output "Cloning $($r.name)..."
try {
git clone $r.sshUrl $dir 2>&1 | ForEach-Object { Write-Output $_ }
} catch {
Write-Warning "Failed to clone $($r.name): $_"
}
}
}

Write-Output "=== MerwelLabs repo sync finished: $(Get-Date -Format o) ==="
Stop-Transcript

# Rotate logs: keep last 30 log files
Get-ChildItem -Path $logDir -Filter 'sync_*.log' | Sort-Object LastWriteTime -Descending | Select-Object -Skip 30 | Remove-Item -Force -ErrorAction SilentlyContinue