From 4e74ddb21802ce883b41570700a9e2307415ca95 Mon Sep 17 00:00:00 2001 From: Minidoracat Date: Thu, 5 Jun 2025 09:14:02 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E5=9C=A8=E6=B8=AC=E8=A9=A6?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E4=B8=AD=E6=96=B0=E5=A2=9E=E7=80=8F=E8=A6=BD?= =?UTF-8?q?=E5=99=A8=E5=95=9F=E5=8B=95=E5=8A=9F=E8=83=BD=EF=BC=8C=E6=95=B4?= =?UTF-8?q?=E5=90=88=20WSL=20=E7=92=B0=E5=A2=83=E6=AA=A2=E6=B8=AC=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E5=8D=87=E8=B7=A8=E5=B9=B3=E5=8F=B0=E6=B8=AC=E8=A9=A6?= =?UTF-8?q?=E9=AB=94=E9=A9=97=EF=BC=8C=E4=B8=A6=E8=99=95=E7=90=86=E5=95=9F?= =?UTF-8?q?=E5=8B=95=E5=A4=B1=E6=95=97=E7=9A=84=E6=83=85=E6=B3=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mcp_feedback_enhanced/test_web_ui.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/mcp_feedback_enhanced/test_web_ui.py b/src/mcp_feedback_enhanced/test_web_ui.py index 5664917..4fc4a1c 100644 --- a/src/mcp_feedback_enhanced/test_web_ui.py +++ b/src/mcp_feedback_enhanced/test_web_ui.py @@ -40,6 +40,7 @@ from .i18n import t try: # 使用新的 web 模組 from .web import WebUIManager, launch_web_feedback_ui, get_web_ui_manager + from .web.utils.browser import smart_browser_open, is_wsl_environment WEB_UI_AVAILABLE = True debug_log("✅ 使用新的 web 模組") except ImportError as e: @@ -143,6 +144,21 @@ def test_web_ui(keep_running=False): } debug_log(f"✅ 測試會話創建成功 (ID: {session_id[:8]}...)") debug_log(f"🔗 測試 URL: {session_info['url']}") + + # 測試瀏覽器啟動功能 + try: + debug_log("🌐 測試瀏覽器啟動功能...") + if is_wsl_environment(): + debug_log("✅ 檢測到 WSL 環境,使用 WSL 專用瀏覽器啟動") + else: + debug_log("ℹ️ 非 WSL 環境,使用標準瀏覽器啟動") + + smart_browser_open(session_info['url']) + debug_log(f"✅ 瀏覽器啟動成功: {session_info['url']}") + except Exception as browser_error: + debug_log(f"⚠️ 瀏覽器啟動失敗: {browser_error}") + debug_log("💡 這可能是正常的,請手動在瀏覽器中開啟上述 URL") + except Exception as e: debug_log(f"❌ 會話創建失敗: {e}") return False, None