mirror of
https://github.com/OLmatter/glm-coding-helper.git
synced 2026-10-06 15:13:13 +08:00
fix: repair incomplete backend environment on start
This commit is contained in:
@@ -54,15 +54,22 @@ $GpuPython = Join-Path $Root ".venv_paddle_gpu\Scripts\python.exe"
|
||||
$ImportCode = "import ultralytics, paddleocr, paddlex, cv2, PIL, numpy"
|
||||
|
||||
$Ready = $false
|
||||
$SelectedPython = ""
|
||||
if ($Selected -eq "gpu") {
|
||||
$SelectedPython = $GpuPython
|
||||
$Ready = Test-PythonImports $GpuPython $ImportCode
|
||||
} else {
|
||||
$SelectedPython = $CpuPython
|
||||
$Ready = Test-PythonImports $CpuPython $ImportCode
|
||||
}
|
||||
|
||||
if (-not $Ready) {
|
||||
Write-Host "Backend environment is missing or incomplete. Installing $Selected environment..."
|
||||
$argsList = @("-Target", $Selected)
|
||||
if ($SelectedPython -and (Test-Path $SelectedPython)) {
|
||||
Write-Host "Existing backend environment failed import checks. Recreating it..."
|
||||
$argsList += "-Recreate"
|
||||
}
|
||||
foreach ($arg in $PipArg) {
|
||||
$argsList += "-PipArg"
|
||||
$argsList += $arg
|
||||
|
||||
@@ -40,7 +40,7 @@ function Test-BackendMainPython {
|
||||
$ErrFile = [System.IO.Path]::GetTempFileName()
|
||||
try {
|
||||
$Proc = Start-Process -FilePath $PythonPath `
|
||||
-ArgumentList @("-c", "import ultralytics") `
|
||||
-ArgumentList @("-c", "import ultralytics, PIL, cv2, numpy") `
|
||||
-NoNewWindow `
|
||||
-Wait `
|
||||
-PassThru `
|
||||
|
||||
+1
-1
@@ -2,5 +2,5 @@
|
||||
chcp 65001 >nul
|
||||
cd /d "%~dp0"
|
||||
echo Starting GLM Coding Helper backend...
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "scripts\start_backend.ps1" -Mode cpu -Port 8888
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "scripts\one_click_start.ps1" -Target cpu -Port 8888
|
||||
pause
|
||||
|
||||
Reference in New Issue
Block a user