Upload 2 files
Browse files- LTX2.3/API issues-API问题办法.bat +37 -0
- LTX2.3/fix_ltx.ps1 +43 -0
LTX2.3/API issues-API问题办法.bat
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
chcp 65001 >nul
|
| 3 |
+
title LTX Local GPU Fix Tool
|
| 4 |
+
|
| 5 |
+
echo ========================================
|
| 6 |
+
echo LTX Local GPU Fix Tool
|
| 7 |
+
echo ========================================
|
| 8 |
+
echo.
|
| 9 |
+
|
| 10 |
+
net session >nul 2>&1
|
| 11 |
+
if %errorlevel% neq 0 (
|
| 12 |
+
echo [!] Please run as Administrator
|
| 13 |
+
pause
|
| 14 |
+
exit /b 1
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
echo [1/2] Reading LTX from shortcut...
|
| 18 |
+
|
| 19 |
+
:: Run PowerShell script to handle everything
|
| 20 |
+
powershell -ExecutionPolicy Bypass -File "%~dp0fix_ltx.ps1"
|
| 21 |
+
|
| 22 |
+
echo.
|
| 23 |
+
echo [2/2] Clearing API Key...
|
| 24 |
+
set "settings_file=%USERPROFILE%\AppData\Local\LTXDesktop\settings.json"
|
| 25 |
+
|
| 26 |
+
if exist "%settings_file%" (
|
| 27 |
+
powershell -Command "(Get-Content '%settings_file%' -Raw) -replace '\"fal_api_key\": \"[^\"]*\"', '\"fal_api_key\": \"\"' | Set-Content '%settings_file%'"
|
| 28 |
+
echo ^_^ API Key cleared
|
| 29 |
+
) else (
|
| 30 |
+
echo [!] settings.json not found
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
echo.
|
| 34 |
+
echo ========================================
|
| 35 |
+
echo Done! Please restart LTX Desktop
|
| 36 |
+
echo ========================================
|
| 37 |
+
pause
|
LTX2.3/fix_ltx.ps1
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
| 2 |
+
|
| 3 |
+
# Find shortcut in LTX_Shortcut folder
|
| 4 |
+
$shortcut = Get-ChildItem -Path "$scriptDir\LTX_Shortcut" -Filter "*.lnk" | Select-Object -First 1
|
| 5 |
+
|
| 6 |
+
if (-not $shortcut) {
|
| 7 |
+
Write-Host "[!] No shortcut found in LTX_Shortcut folder"
|
| 8 |
+
Write-Host "Please put LTX Desktop shortcut in LTX_Shortcut folder"
|
| 9 |
+
exit 1
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
Write-Host " Found: $($shortcut.Name)"
|
| 13 |
+
|
| 14 |
+
# Get target path from shortcut
|
| 15 |
+
$shell = New-Object -ComObject WScript.Shell
|
| 16 |
+
$shortcutObj = $shell.CreateShortcut($shortcut.FullName)
|
| 17 |
+
$targetPath = $shortcutObj.TargetPath
|
| 18 |
+
|
| 19 |
+
# Remove \LTX Desktop.exe from end
|
| 20 |
+
$ltxDir = $targetPath -replace '\\LTX Desktop\.exe$', ''
|
| 21 |
+
|
| 22 |
+
if (-not $ltxDir) {
|
| 23 |
+
Write-Host "[!] Could not read shortcut target"
|
| 24 |
+
exit 1
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
Write-Host " LTX Dir: $ltxDir"
|
| 28 |
+
|
| 29 |
+
$policyFile = Join-Path $ltxDir "resources\backend\runtime_config\runtime_policy.py"
|
| 30 |
+
|
| 31 |
+
if (Test-Path $policyFile) {
|
| 32 |
+
Write-Host " Found: $policyFile"
|
| 33 |
+
|
| 34 |
+
$content = Get-Content $policyFile -Raw
|
| 35 |
+
$content = $content -replace [regex]::Escape('vram_gb < 31'), 'vram_gb < 6'
|
| 36 |
+
Set-Content -Path $policyFile -Value $content
|
| 37 |
+
|
| 38 |
+
Write-Host " ^_^ VRAM threshold changed to 6GB"
|
| 39 |
+
} else {
|
| 40 |
+
Write-Host "[!] runtime_policy.py not found"
|
| 41 |
+
Write-Host " Expected: $policyFile"
|
| 42 |
+
exit 1
|
| 43 |
+
}
|