From e49ff641f9b93ff2caa4796ffa46c11e748acbb3 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 26 Jun 2026 14:38:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(web):=20=E6=B6=88=E6=81=AF=E6=A1=86?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=8B=96=E6=8B=BD=E6=96=87=E4=BB=B6=20+=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=9A=E6=AC=A1=E7=B2=98=E8=B4=B4=E4=BA=92=E7=9B=B8?= =?UTF-8?q?=E9=A1=B6=E6=8E=89(bump=200.31.3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 附件 chip 拆出独立托盘 #chat-attach,与状态文字解耦:append+按 rel 去重, 上传进度只写 #chat-hint,不再互相覆盖。整个 #chat-form 加 dragenter/over/ leave/drop(计数防闪烁,只认文件拖拽,微信镜像只读不接收),复用 uploadFiles。 takePastedRels/删除/预览改查托盘;切 task 清残留未发送 chip。 Co-Authored-By: Claude Opus 4.8 (1M context) --- PROGRESS.md | 6 +++ core/__init__.py | 2 +- web/static/dev.html | 9 +++- web/static/js/chat.js | 113 +++++++++++++++++++++++++++++++++--------- 4 files changed, 105 insertions(+), 25 deletions(-) diff --git a/PROGRESS.md b/PROGRESS.md index ba5b06c..b88800c 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -21,6 +21,12 @@ ## 已完成关键能力 +### 2026-06-26 / 消息框支持拖拽文件 + 修多次粘贴互相顶掉(bump 0.31.3) + +- 现象:① 消息框只能粘贴文件不能拖拽;② 连粘多个文件,后一个把前一个的 chip 顶掉,只剩一个。 +- 根因:粘贴附件 chip 和状态文字共用 `#chat-hint`,每次粘贴用 `innerHTML =` 整体重建只塞最新一批,且上传进度回调写 `hint.textContent` 也会清掉已有 chip——附件与状态文字抢同一个容器。 +- 修复(`web/static/dev.html` + `web/static/js/chat.js`):① 新增独立 chip 托盘 `#chat-attach`(textarea 与按钮行之间),chip 累积靠 append + 按 `rel` 去重,状态进度只写 `#chat-hint`,从根上解耦;② 给整个 `#chat-form` 加 `dragenter/over/leave/drop`(enter/leave 计数防闪烁,`_dragHasFiles` 只认文件拖拽,微信镜像只读时不接收),复用 `uploadFiles` + 同一托盘;`takePastedRels` / 删除 / 预览三处改查托盘。 + ### 2026-06-26 / 消息目录圆点错位再修(点击竞态 + 触底兜底)(bump 0.31.2) - 现象(0.20.4 后仍残留):① 点圆点,被点的圆点不变红、活跃态跑到途经轮次(尤其点 #1 跳到 #2);② 点最后一个 / 滚到底,倒数第二个变红。 diff --git a/core/__init__.py b/core/__init__.py index 98d588a..7916856 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -1,3 +1,3 @@ # zcbot 版本号单一事实源:web/app.py 的 FastAPI version、/healthz 返回、前端展示都引这里。 # 改版本只动这一行。 -__version__ = "0.31.2" +__version__ = "0.31.3" diff --git a/web/static/dev.html b/web/static/dev.html index 77a60bf..306713d 100644 --- a/web/static/dev.html +++ b/web/static/dev.html @@ -855,6 +855,12 @@ /* 微信渠道 task 只读镜像:输入框置灰禁手输,引导去微信对话 */ #chat-input.readonly-locked { background: #f0f0f0; color: var(--muted); cursor: not-allowed; } #chat-form .hint { font-size: 11px; color: var(--muted); } + /* 附件托盘:粘贴 / 拖拽的文件 chip 独占一行,累积展示,不与状态文字抢容器 */ + #chat-attach { display: none; flex-wrap: wrap; gap: 4px 0; align-items: center; } + #chat-attach.show { display: flex; } + /* 拖拽文件悬停整个输入区:虚线高亮提示可落点 */ + #chat-form.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--accent-soft); } + #chat-form.drag-over * { pointer-events: none; } /* ───── files ───── */ .crumbs { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; background: #fafafa; } @@ -1505,7 +1511,8 @@