From dc55671191421a60ab2895cc57213175d6f4a985 Mon Sep 17 00:00:00 2001 From: phact Date: Tue, 28 Oct 2025 13:26:40 -0400 Subject: [PATCH] windows check --- src/tui/main.py | 9 +++++++++ src/tui/screens/diagnostics.py | 19 +++++++++++++++++++ src/tui/utils/platform.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/src/tui/main.py b/src/tui/main.py index 51418786..5ddd089c 100644 --- a/src/tui/main.py +++ b/src/tui/main.py @@ -368,6 +368,15 @@ class OpenRAGTUI(App): def on_mount(self) -> None: """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 if not self.container_manager.is_available(): notify_with_diagnostics( diff --git a/src/tui/screens/diagnostics.py b/src/tui/screens/diagnostics.py index bad456e4..a01ae302 100644 --- a/src/tui/screens/diagnostics.py +++ b/src/tui/screens/diagnostics.py @@ -15,6 +15,7 @@ from rich.text import Text from ..managers.container_manager import ContainerManager from ..utils.clipboard import copy_text_to_clipboard +from ..utils.platform import PlatformDetector class DiagnosticsScreen(Screen): @@ -52,6 +53,7 @@ class DiagnosticsScreen(Screen): def __init__(self): super().__init__() self.container_manager = ContainerManager() + self.platform_detector = PlatformDetector() self._logger = logging.getLogger("openrag.diagnostics") self._status_timer = None @@ -199,6 +201,23 @@ class DiagnosticsScreen(Screen): """Get system information 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() info_text.append("Container Runtime Information\n", style="bold") diff --git a/src/tui/utils/platform.py b/src/tui/utils/platform.py index 176c60c6..ff7805bf 100644 --- a/src/tui/utils/platform.py +++ b/src/tui/utils/platform.py @@ -30,6 +30,15 @@ class PlatformDetector: self.platform_system = platform.system() 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: """Detect available container runtime and compose capabilities.""" # First check if we have podman installed @@ -166,6 +175,26 @@ class PlatformDetector: ) as 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: if self.platform_system == "Darwin": return """ @@ -200,6 +229,10 @@ Docker Desktop for Windows: Or Podman Desktop: https://podman-desktop.io/downloads + +For better performance, consider using WSL: + Run: wsl --install + https://docs.microsoft.com/en-us/windows/wsl/install """ else: return """