feat(renderer): platform-gated dual renderer backend with isolated QtWebEngine profiles

Windows prefers WebView2, Linux uses QtWebEngine only; pythonnet deps are win32-marked. Each QtWebEngine instance gets its own profile under data/webengine, and Chromium flags are sanitized before QApplication (--no-sandbox accepted only for explicit root/container use).
This commit is contained in:
2026-09-17 16:40:03 +08:00
parent 342e53df02
commit 554be4f92b
6 changed files with 445 additions and 6 deletions
+16 -3
View File
@@ -19,13 +19,26 @@ PyQt6-WebEngine-Qt6==6.10.2
# ---- 大模型 SDKOpenAI 兼容接口;DeepSeek / opencode-go / 自建反代均走它)----
openai==2.26.0
# ---- WebView2 绑定:pythonnetimport clr+ 其加载器 ----
pythonnet==3.1.0
clr_loader==0.3.1
# ---- WebView2 绑定:pythonnetimport clr+ 其加载器(仅 WindowsLinux 自动跳过)----
pythonnet==3.1.0; sys_platform == "win32"
clr_loader==0.3.1; sys_platform == "win32"
# ---- PDF 附件解析(ui/views/main_window.py → tools/builtin_tools/pdf_reader.py----
PyMuPDF==1.28.0
# ===========================================================================
# Linux 源码运行(Ubuntu 22.04/24.04 x64,仅 QtWebEngine;不装 WebView2 任何东西)
# ===========================================================================
# 1) pip install -r requirements.txt # pythonnet/clr_loader 带平台 markerLinux 自动跳过
# 2) 安装 QtWebEngine 运行所需的系统库(apt,按需选装):
# sudo apt install -y libnss3 libxkbcommon0 libfontconfig1 libdbus-1-3 \
# libgl1 libegl1 libasound2t64 # 24.04 用 libasound2t6422.04 用 libasound2
# 离屏测试另需:QT_QPA_PLATFORM=offscreen
# 3) 运行:python3.10 main.py
# - 只使用 QtWebEngine;每实例独立 profiledata/webengine/profile_<pid>_*
# - root/容器启动若页面空白:显式 QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox" python3.10 main.py
# (启动会打印高可见风险警告;普通桌面不要加)
# ===========================================================================
# 以下仅在需要时安装
# ===========================================================================