windows check

This commit is contained in:
phact 2025-10-28 13:26:40 -04:00
parent 0af2e5928a
commit dc55671191
3 changed files with 61 additions and 0 deletions

View file

@ -368,6 +368,15 @@ class OpenRAGTUI(App):
def on_mount(self) -> None: def on_mount(self) -> None:
"""Initialize the application.""" """Initialize the application."""
# Check if running on native Windows and recommend WSL
if self.platform_detector.is_native_windows():
notify_with_diagnostics(
self,
"Running on native Windows. For best experience, use WSL. See diagnostics for details.",
severity="warning",
timeout=15,
)
# Check for runtime availability and show appropriate screen # Check for runtime availability and show appropriate screen
if not self.container_manager.is_available(): if not self.container_manager.is_available():
notify_with_diagnostics( notify_with_diagnostics(

View file

@ -15,6 +15,7 @@ from rich.text import Text
from ..managers.container_manager import ContainerManager from ..managers.container_manager import ContainerManager
from ..utils.clipboard import copy_text_to_clipboard from ..utils.clipboard import copy_text_to_clipboard
from ..utils.platform import PlatformDetector
class DiagnosticsScreen(Screen): class DiagnosticsScreen(Screen):
@ -52,6 +53,7 @@ class DiagnosticsScreen(Screen):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.container_manager = ContainerManager() self.container_manager = ContainerManager()
self.platform_detector = PlatformDetector()
self._logger = logging.getLogger("openrag.diagnostics") self._logger = logging.getLogger("openrag.diagnostics")
self._status_timer = None self._status_timer = None
@ -199,6 +201,23 @@ class DiagnosticsScreen(Screen):
"""Get system information text.""" """Get system information text."""
info_text = Text() info_text = Text()
# Platform information
info_text.append("Platform Information\n", style="bold")
info_text.append("=" * 30 + "\n")
info_text.append(f"System: {self.platform_detector.platform_system}\n")
info_text.append(f"Machine: {self.platform_detector.platform_machine}\n")
# Windows-specific warning
if self.platform_detector.is_native_windows():
info_text.append("\n")
info_text.append("⚠️ Native Windows Detected\n", style="bold yellow")
info_text.append("-" * 30 + "\n")
info_text.append(self.platform_detector.get_wsl_recommendation())
info_text.append("\n")
info_text.append("\n")
# Container runtime information
runtime_info = self.container_manager.get_runtime_info() runtime_info = self.container_manager.get_runtime_info()
info_text.append("Container Runtime Information\n", style="bold") info_text.append("Container Runtime Information\n", style="bold")

View file

@ -30,6 +30,15 @@ class PlatformDetector:
self.platform_system = platform.system() self.platform_system = platform.system()
self.platform_machine = platform.machine() self.platform_machine = platform.machine()
def is_native_windows(self) -> bool:
"""
Check if running on native Windows (not WSL).
Returns True if running on native Windows, False otherwise.
WSL environments will return False since they identify as Linux.
"""
return self.platform_system == "Windows"
def detect_runtime(self) -> RuntimeInfo: def detect_runtime(self) -> RuntimeInfo:
"""Detect available container runtime and compose capabilities.""" """Detect available container runtime and compose capabilities."""
# First check if we have podman installed # First check if we have podman installed
@ -166,6 +175,26 @@ class PlatformDetector:
) as e: ) as e:
return False, 0, f"Error checking Podman VM memory: {e}" return False, 0, f"Error checking Podman VM memory: {e}"
def get_wsl_recommendation(self) -> str:
"""Get recommendation message for native Windows users to use WSL."""
return """
Running on native Windows detected.
For the best experience, we recommend using Windows Subsystem for Linux (WSL).
To set up WSL:
1. Open PowerShell or Command Prompt as Administrator
2. Run: wsl --install
3. Restart your computer
4. Set up your Linux distribution (Ubuntu recommended)
5. Install Docker or Podman in WSL
Learn more: https://docs.microsoft.com/en-us/windows/wsl/install
Alternatively, you can use Docker Desktop for Windows:
https://docs.docker.com/desktop/install/windows-install/
"""
def get_installation_instructions(self) -> str: def get_installation_instructions(self) -> str:
if self.platform_system == "Darwin": if self.platform_system == "Darwin":
return """ return """
@ -200,6 +229,10 @@ Docker Desktop for Windows:
Or Podman Desktop: Or Podman Desktop:
https://podman-desktop.io/downloads https://podman-desktop.io/downloads
For better performance, consider using WSL:
Run: wsl --install
https://docs.microsoft.com/en-us/windows/wsl/install
""" """
else: else:
return """ return """