From b3b9b1390c1448cfbf89161a9b5c8e1667db15f6 Mon Sep 17 00:00:00 2001 From: Daulet Amirkhanov Date: Thu, 11 Sep 2025 10:34:30 +0100 Subject: [PATCH] ui.py: clean up function meant to serve static frontend --- cognee/api/v1/ui/ui.py | 43 ------------------------------------------ 1 file changed, 43 deletions(-) diff --git a/cognee/api/v1/ui/ui.py b/cognee/api/v1/ui/ui.py index 36a4f4305..2e73e2eaf 100644 --- a/cognee/api/v1/ui/ui.py +++ b/cognee/api/v1/ui/ui.py @@ -264,49 +264,6 @@ def is_development_frontend(frontend_path: Path) -> bool: return False -def start_python_server(frontend_path: Path, host: str, port: int) -> Optional[subprocess.Popen]: - """ - Start a Python HTTP server to serve downloaded frontend assets. - This doesn't require Node.js and works with pre-built assets. - """ - try: - # Change to the frontend directory - original_cwd = os.getcwd() - os.chdir(frontend_path) - - # Use subprocess to run the server so we can return a process handle - cmd = ["python", "-m", "http.server", str(port), "--bind", host] - - process = subprocess.Popen( - cmd, cwd=frontend_path, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True - ) - - # Restore original directory - os.chdir(original_cwd) - - # Give it a moment to start - time.sleep(2) - - # Check if process is still running - if process.poll() is not None: - stdout, stderr = process.communicate() - logger.error("Python HTTP server failed to start:") - logger.error(f"stdout: {stdout}") - logger.error(f"stderr: {stderr}") - return None - - return process - - except Exception as e: - logger.error(f"Failed to start Python HTTP server: {str(e)}") - # Restore original directory on error - try: - os.chdir(original_cwd) - except OSError: - pass - return None - - def prompt_user_for_download() -> bool: """ Ask user if they want to download the frontend assets.