Skip to content

fix(web-admin): 前端全面排查修复——移动端、阅读视图、性能与测试基建 - #308

Closed
3aKHP wants to merge 8 commits into
fix/web-admin-securityfrom
fix/web-admin-frontend-overhaul
Closed

3aKHP wants to merge 8 commits into
fix/web-admin-securityfrom
fix/web-admin-frontend-overhaul

Conversation

@3aKHP

@3aKHP 3aKHP commented Oct 19, 2026

Copy link
Copy Markdown
Owner

概述

Web Admin 前端全面排查修复,覆盖移动端适配、长文阅读视图、性能(首屏分包 + 轮询治理)、构建工具链与测试基建。配套真实生产数据完成了两轮全站浏览器实测(29 路由 × 桌面/移动端)逐页验收。

堆叠关系:base 为 #307(fix/web-admin-security)——本分支的两个 vitest 用例依赖其 api/index.ts 的 BASE 导出与 useAuth 新行为。#307 合并后本 PR 自动改指 dev,diff 即收拢为下列 6 个 commit。

commits:

  1. feat(build): upgrade frontend toolchain to Vite 8 — Vite 5→8、plugin-vue 5→6,消除工具链传递依赖 7 条已知漏洞(pnpm audit 清零);dompurify 3.4.17 / Vue 3.5.44 / marked 18.1.1;图标库迁移至官方 @lucide/vue;CI 新增生产依赖审计;登录表单补 autocomplete。
  2. feat(test): add vitest unit test stack — tests/unit/ vitest 栈(happy-dom),与既有 node --test 双栈并行;覆盖请求封装、路由/导航一致性、UiIcon 映射与 useAuth。
  3. perf(web-admin): code splitting and polling control — 除首页外全部路由级动态 import,首屏 JS 约 858KB(gzip 291KB)→187KB(gzip 69KB)、CSS 221KB→43KB;标签页隐藏时暂停全部轮询/心跳;轮询失败指数退避;纪元看板在飞去重与时间轴光标增量通道;实时日志级别着色预计算、Trace 插入即保序;长列表 500 条软上限。
  4. fix(ui): mobile layout and empty-state fixes — 移动端页头操作区换行、纪元/用量/贴吧横向溢出、审计卡片化、各列表小滚动窗解放;空态与文案一致性一批;LLM 配置 Providers/MCP 面板定价与删除/重命名联动修复等。
  5. fix(ui): reading view and lock-chain cleanup — 总结页阅读视图整页滚动;LLM 配置页拆锁改页面级滚动;Config/Skills/资料/对话四页拆除视口锁高链(Skill 页文件表曾被压成 48px 一行高、编辑器仅 1/3 屏);编辑器 min-height 统一 55/60vh 约定。
  6. docs: add frontend module docs and sync references — 新增 frontend/README.md,architecture/style/index 同步。

验证

  • 本分支独立复跑:vue-tsc 零错误;node --test 59/59 + vitest 26/26(其中一次连跑中 cjs 出现 1 例偶发失败,单独连跑 4 次全绿,疑为竞态用例在并行负载下的时序敏感,留 CI 复核);vite build 成功。
  • 后端 ruff 全过、pytest tests/unit 2923 全过;validate_toml_examples.py 与 self-docs 引用同步检查通过。
  • 浏览器实测验收:桌面 1440×900 与移动 390×844 两档,29 路由逐页量化测量(内滚窗高度占比、横向溢出、控制台告警)修复前后对比通过。
  • 定级门槛 scripts/check/deep-cr-trigger.sh dev:trigger=true,与 fix(security): Web Admin 登录限流、会话与 API 表面安全加固 #307 合并范围一并按 Huge 流程组织 Deep-CR 与独立 CR,结论汇总后请求人工合并。

CHANGELOG 草稿

变更

  • Web Admin 前端构建工具链升级:Vite 5 → 8、@vitejs/plugin-vue 5 → 6。消除了工具链传递依赖中 7 条已知安全漏洞(涉及 vite、esbuild、postcss、nanoid、source-map-js),pnpm audit 现已清零。构建产物结构不变,对部署与使用无影响。
  • Web Admin 首屏大幅减重:30 个页面中除首页「概览」外全部改为按路由按需加载,日期选择器样式与脚本也随「审计」「定时消息」页面按需加载。首屏 JS 由约 858KB(gzip 291KB)降至约 187KB(gzip 69KB),首屏 CSS 由约 221KB 降至 43KB,弱网或低配设备打开管理后台明显变快。
  • 对话日志、语录、贴吧帖子池的「加载更多」增加 500 条软上限:达到上限后停止追加并提示改用关键词缩小范围,避免超长列表拖慢页面。
  • 实时日志的级别着色改为日志写入时预计算,日志高峰期页面渲染更流畅;LLM Trace 列表改为插入即保序,事件高频到达时不再逐条全量重排。
  • 开启低动效(或系统减少动态效果)时,背景光场不再跟踪鼠标移动。

修复

  • Web Admin:升级 dompurify 至 3.4.17、Vue 至 3.5.44(含 @vue/server-renderer 安全修复)、marked 至 18.1.1,消除已知安全公告条目。
  • Web Admin:图标库由 lucide-vue-next 迁移至官方维护的 @lucide/vue,界面图标与名称保持不变。
  • Web Admin:主题切换调试钩子 __qqToggleTheme 仅在开发环境注册,生产构建不再向 window 暴露。
  • Web Admin:登录表单补充 autocomplete 属性(username / current-password),密码管理器可正常识别。
  • Web Admin:CI 前端任务新增生产依赖高级别漏洞审计步骤(pnpm audit --prod --audit-level=high)。
  • Web Admin 后台标签页不再空转:纪元看板的每分钟快照、LLM 配置的 5 秒状态轮询、调度器监控的 30 秒刷新、状态栏与「Bot 在线」心跳时钟,在标签页隐藏时全部暂停,回到前台自动按原节奏恢复。挂后台的标签页不会再持续向 Bot 进程提交快照任务或打状态请求。
  • Web Admin 轮询失败改为指数退避:LLM 配置状态轮询(5s 起翻倍、封顶 30s)、调度器监控(30s 起翻倍、封顶 120s)、诊断任务的结果读取(1s 起翻倍、封顶 10s)在连续失败时自动拉长间隔,成功后复位;后端重启或故障窗口内不再以固定节奏打满失败请求。
  • Web Admin 纪元看板的「刷新快照」增加在飞去重:手动点击与每分钟自动刷新并发时只保留一个,不会向 Bot 重复提交快照任务。
  • Web Admin 纪元看板播放与擦洗更顺滑:时间轴光标改为轻量增量更新,高频移动时光标照常跟随,但底层图表数据与配色配置不再被反复整体重设。
  • Web Admin 空态与文案一致性修复批:「记忆管理」「语录」未选群时增加选择引导空态,已选群无数据时补充说明;「调度器监控」空态按快照状态区分「Bot 尚未上报」「快照已过期」「暂无调度任务」,避免 bot 离线被误读为任务丢失;「人格管理」桌面端未选中提示改为贴顶对齐,不再被长列表推出视口;「LLM Trace」移动端详情面板改为选中记录后才展示,空态不再占屏;「LLM 配置中心」桌面端渠道详情工作区在矮视口下保底约 60vh 高(超出部分走页面级滚动);移动端空态的「从左侧选择…」统一改为方向中性文案(人格/Skill/贴吧/日志归档);「贴吧帖子池」的「立即同步全部」增加二次确认;「诊断」页在 Bot 离线时显示显式提示条;「消息统计」空态补充数据来源引导;「日志归档」空列表时不再重复展示选择引导;「实时日志」无日志文件时连接状态改为「已连接,等待日志」并收敛移动端轻微超高;「牛牛大作战」文案模式下拉补占位项;「功能群组管理」移动端群选择下拉独占一行不再截断;「Skill 管理」预置同步标题不再词中断行;浅色主题「未发布」等 warn 徽标文字色加深至可读对比度(暗色不变)。
  • 修复 Web Admin 手机端多个页面列表被压缩成小滚动窗的问题:人格管理的 persona 列表(原限高 200px,40+ 条只露约 4 条)、群 LLM 设置的覆盖对象列表、配置页的文件列表在手机端均改为随页面自然展开,直接整页滑动浏览,不再需要在狭窄的内嵌小窗里滚动查找。
  • 修复手机端编辑配置/资料文件可用性差的问题:配置页 TOML 编辑器最小高度提升至 60vh,资料页 YAML 编辑器与人格页编辑器提升至 55vh,消除了文件列表与编辑器叠套的双层嵌套滚动,手机上修改长配置不再只剩十几行可见。
  • 修复 LLM 配置中心手机端渠道列表 153px 嵌套滚动的问题:窄屏下渠道切换改为下拉选择器(含协议、模型数与停用标记),渠道详情各分节照常整页展开,选渠道与改详情之间不再需要在两个滚动盒之间往返。
  • 修复 Web Admin 手机端图表/表格页面横向溢出:纪元、LLM 用量、贴吧页面在手机端不再整页左右横滑:页头操作按钮组在窄屏下自动换行、完整可达(此前贴吧工具栏最末按钮被视口裁切)。
  • 审计日志在手机端由被挤压裁切的横向表格改为逐条卡片展示,操作与目标徽标完整显示,点击条目展开的变更前后摘要随卡片完整阅读。
  • 修复 Web Admin 手机端页头操作按钮被裁切的问题:窄屏下页头操作区自动换行独占一行,配置页「保存」、人格页「新建」、技能页「安装」等按钮不再不可达或需横向滑动。
  • 修复安全响应头 CSP frame-ancestors 的非法指令值导致的浏览器控制台报错(随 fix(security): Web Admin 登录限流、会话与 API 表面安全加固 #307 的响应头一并生效)。
  • 总结页阅读视图正文不再被挤进小窗:打开报文阅读时隐藏工具栏与健康度卡片,正文卡片自适应内容高度、随页面级滚动通读全文;进入阅读自动回到页面顶部,返回列表时恢复原滚动位置。列表模式同步改为页面级滚动(修复前列表区仅剩 37% 视口高)。
  • LLM 配置页整页改为页面级滚动:移除整页视口锁高与各分区面板的内部小滚动,桌面端侧边导航与渠道列表改为随滚动吸附在视口顶部(内容超视口时保持可见可操作);渠道分区的列表/详情内容自然延展,删除原 60vh 保底补丁链。JSON 预览、MCP 工具清单等原始内容限高区保持不变,移动端布局与原生渠道选择器不受影响。
  • 修复 Skill 页(桌面端)选中技能并打开文件后,文件资源表被压成一行高(48px)、代码编辑器被压到约三分之一屏的问题;相关区域改为随页面整高铺开。
  • Skill、资料(llm-about)、配置、对话四个工作台页面拆除视口锁高链,统一为页面级滚动:左侧列表吸附在视口顶部(列表过长时在吸附面板内自滚),代码/YAML 编辑器高度固定为 55-60vh 的既有约定。
  • 移动端既有断点行为(分栏堆叠、列表限高切换器、编辑器 55/60vh)保持不变。

3aKHP added 8 commits October 20, 2026 04:48
- Vite 5 to 8, @vitejs/plugin-vue 5 to 6; clears 7 known vulnerabilities in transitive build deps (vite, esbuild, postcss, nanoid, source-map-js); pnpm audit is now clean
- Bump dompurify to 3.4.17, Vue to 3.5.44 (includes @vue/server-renderer security fix), marked to 18.1.1
- Migrate the icon library from lucide-vue-next to the officially maintained @lucide/vue; icon names and rendering stay unchanged
- CI frontend job now audits production dependencies (pnpm audit --prod --audit-level=high)
- vite.config.ts switches to vitest/config and registers the @ alias plus the tests/unit include glob, preparing the vitest stack
- Login form gains autocomplete attributes (username / current-password) so password managers recognize it
- New tests/unit/ vitest stack (happy-dom) alongside the existing node --test *.test.cjs harness; pnpm test runs both
- Covers the request helper, router/nav consistency, UiIcon mapping and the useAuth composable
- All routes except the home dashboard are now lazy route-level dynamic imports derived from nav.ts; datepicker styles load with the pages that need them. First-screen JS drops from ~858KB (gzip 291KB) to ~187KB (gzip 69KB), first-screen CSS from ~221KB to ~43KB
- Pause background polling while the tab is hidden and resume on return: epochs 60s snapshot, llm-config 5s status poll, cron dashboard 30s refresh, status-bar heartbeat clock; a hidden tab no longer submits snapshot jobs or status requests to the bot process
- Exponential backoff on consecutive poll failures: llm-config 5s doubling up to 30s, cron dashboard 30s up to 120s, diagnostic result reads 1s up to 10s; success resets the cadence
- Epochs dashboard dedupes in-flight snapshot refreshes, and the timeline cursor moves through a lightweight incremental channel instead of resetting the whole chart option
- Logs-live precomputes level colors at ingest; logs-trace keeps events ordered at insert instead of re-sorting per event
- Load-more lists (conversations, quotes, tieba pool) stop at a 500-entry soft cap and point to keyword filtering
- Remove the unused useAsyncData composable
- Page-header action groups wrap onto their own row on narrow screens, so save/create/install buttons stay reachable without horizontal scrolling; epochs, llm-usage and tieba pages no longer overflow sideways
- Audit log switches from a squeezed table to per-entry cards on mobile, with full action/target badges and expandable before/after summaries
- Persona list, group-LLM override list and the config file list no longer collapse into tiny inner scroll windows on phones; group selectors take a full row
- Empty states and wording pass: selection hints for memory/quotes, cron dashboard distinguishes bot-not-reporting vs stale snapshot vs no tasks, diagnostics shows an explicit banner when the bot is offline, stats explains data provenance, logs-archive stops double prompting, logs-live reports connected-but-waiting, direction-neutral wording for personas/skills/tieba/logs-archive
- Tieba sync-all asks for confirmation before firing multi-round external fetching
- LLM config channel list becomes a native select on narrow screens (with protocol, model count and disabled marker); skill preset sync title no longer breaks mid-word
- Light-theme warn badge text darkened to readable contrast (dark theme unchanged); niuniu text-mode select gains a placeholder
- llm-config.test.cjs gains the polling backoff and hidden-tab cases pinning the store changes from the perf commit
- Summary reading view: the report body no longer gets squeezed into a small inner pane; toolbar and health cards hide while reading, the body card follows content height and the whole page scrolls; entering reading scrolls to top, returning restores the list scroll position
- LLM config page scrolls at page level end to end: the viewport lock and per-section inner scroll panes are gone, the side nav and channel list stick to the viewport top instead, and the old 60vh patch chain is removed; raw-content caps (JSON preview, MCP tool list) stay
- Remove the page-view-fill lock chain from config, skills, llm-about and conversations: left list panels become sticky, editors keep the agreed 55-60vh min height, and mobile breakpoints are unchanged. Skills desktop no longer crushes the file table to one line (48px) and the editor to a third of the screen when a file is open
- App.vue: drop the now-consumer-less :has(> .page-view-fill) rule and register the __qqToggleTheme debug hook in dev builds only
- New frontend/README.md as the entry point for the Web Admin frontend module: stack, directory conventions, dev commands, the dual test stacks and the deployment shape
- docs/dev/architecture.md documents the frontend/ engineering layer; docs/dev/style.md records the nav.ts single-source-of-truth and vitest-first testing conventions; docs/index.md links the new entry
- An aborted sync stream no longer fires onDone/onMessage: closing the old stream on re-entry or unmount previously let its async completion clobber the new stream's state (handle cleared, syncing reset, extra onSynced refresh) and fired callbacks after the component was gone
- HTTP errors (401/403/405/500) now surface as a status line in the sync log instead of silently reporting completion
- Soft-cap notice no longer masks the end-of-list hint in tieba and conversations when the server actually has no more entries
- Epochs dashboard: a manual snapshot click colliding with an in-flight auto refresh now shows loading feedback instead of being silently dropped
- Cron dashboard: snapshot staleness now re-evaluates on every poll cycle while the page stays open, so the empty state flips to the stale variant when the bot dies mid-session
- frontend README: views/ holds 29 routed pages plus the statically imported login gate, not 30
@3aKHP
3aKHP force-pushed the fix/web-admin-frontend-overhaul branch from 076ee1e to 8d324a4 Compare October 19, 2026 20:54
@3aKHP

3aKHP commented Oct 19, 2026

Copy link
Copy Markdown
Owner Author

评审汇合(Deep-CR 五透镜 + 独立 Tier-1 CR + 交叉复核)后的修复轮,新 head:8d324a4

七轨评审结论:无 Blocking。本 PR 侧已修复:

  • fireDone 语义三合一(三轨命中):startTiebaSync 引入 aborted 标志——主动 close 后不再触发 onDone/onMessage,修复重入竞态(旧流微任务误清新流句柄)与卸载后多发请求;HTTP 错误(401/403/405/500)向同步日志写状态行,不再静默显示「已完成」
  • 软上限提示不再遮蔽「已到末尾/最早」(TiebaView/ConversationsView:仅在服务端确有更多时提示上限)
  • Epochs 看板手动刷新撞上在飞自动请求时给出 loading 反馈,不再静默丢弃
  • CronDashboard 空态的「快照已过期」分支随轮询周期在页面存活期间正常翻转(nowTick)
  • README 路由页面计数修正为 29 + 登录门
  • commit message 修正:原 fdf6405 虚报了基线已存在的 ProvidersPanel 定价行为,已 reword 为如实描述移动端渠道下拉选择器(现 b94ba42)

验证:vue-tsc 零错;59+26 双栈全绿;build 通过;后端 pytest 2925 全过(堆叠含 #307 修复)。

@3aKHP
3aKHP deleted the branch fix/web-admin-security October 19, 2026 21:15
@3aKHP 3aKHP closed this Oct 19, 2026
@3aKHP
3aKHP deleted the fix/web-admin-frontend-overhaul branch October 19, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant