From 19d214039c00cd442f069ff082f6e508db77891f Mon Sep 17 00:00:00 2001 From: lhl Date: Mon, 31 Aug 2026 12:15:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E5=AE=8C=E6=95=B4=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=20chat.js=20UI=20=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91?= =?UTF-8?q?=20+=20=E6=8A=98=E5=8F=A0=E6=8C=89=E9=92=AE=E5=9B=BE=E6=A0=87/?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 背景:之前 commit a16996b 从 git 520c9e2 恢复 chat.html 内联 JS 段到 chat.js 时,提取过程因 PowerShell 5.1 `>` 重定向默认按 UTF-16 LE 写入文件、 后续 UTF-8 解码时字节被错误解读,导致 chat.js 包含大量乱码字符和未关闭 的字符串字面量。Node.js 解析时报 `Unexpected token ':'` 错误。 本次重新提取: - 用 `git cat-file -p` 直接获取原 chat.html 的 UTF-8 原始字节 - 找到内联 `` 段(从 byte 24765 到 54899,共 30134 字节) - 按 UTF-8 解码后写回 chat.js(30279 字节) - 验证 Node.js 解析通过 变更: - chat.js 整体重写:27094 字节 → 30306 字节 - 恢复正确的简体中文 UI 文案("请新建项目或者选择项目"等) - 恢复正确的字符串字面量(之前是乱码字符) 同时恢复 commit 264054b 的折叠按钮增强: - toggleSidebar 切换图标 '«' / '»' - 切换 title "折叠侧边栏" / "展开侧边栏" - 切换 data-state 'expanded' / 'collapsed' 零行为变更:JS 内容完全从 git 520c9e2 恢复, 只是 264054b 的 toggleSidebar 增强被应用。 验证(node --check): - chat.js 0 errors - /static/chat.js 服务端响应 200, 30306 bytes 后续浏览器手测清单: - [ ] 侧边栏折叠按钮:点击正常切换 + 图标/标题变化 - [ ] 项目下拉:弹出 + 切换项目 - [ ] 新建项目抽屉:滑入 - [ ] 发送消息:用户气泡 + 自动滚动 - [ ] 上传:选文件 + 上传进度 --- src/genesis/server/static/chat.js | 1402 +++++++++++++++-------------- 1 file changed, 718 insertions(+), 684 deletions(-) diff --git a/src/genesis/server/static/chat.js b/src/genesis/server/static/chat.js index 54620a2..cb0e825 100644 --- a/src/genesis/server/static/chat.js +++ b/src/genesis/server/static/chat.js @@ -1,686 +1,720 @@ // src/genesis/server/static/chat.js -// Genesis Chat UI 涓氬姟閫昏緫锛坴1 鎷嗗垎鑷師 chat.html 鍐呰仈