Skip to content

[Bug] 批注块无法随草稿一同发送(dsh 0.1.2-alpha.1 / DSH Desktop 2.0.4) #41

Description

@Ztyss

现象

选中助手文字做批注(「批注 ×N」标签出现)后,在输入框按 Enter 发送问题,发出的消息里没有批注块——模型只收到输入框里的文字。批注待发送集始终保留(不丢失、不刷新、不消费),也不会随后续任意一次 Enter 发出。

环境

  • DSH:DSH Desktop 2.0.4(内核 @deepseek-ai/dsh 0.1.2-alpha.1)
  • 插件:@changfenhuang/dsh-annotation 1.4.5(npm,github:omdsh-dev/dsh-annotation#41731ec)
  • 操作系统:Windows 11(10.0.26200,x64)
  • 形态:Web GUI(桌面 WebView),官方 bundle 路径安装

复现步骤

  1. 助手回复里选中一段文字 → 工具条「批注」→ 写批注保存(「批注 ×1」标签出现)
  2. 输入框输入问题文字(非斜杠命令草稿)→ 直接按 Enter 发送
  3. 实际发出消息 = 只有输入框文字;「批注 ×1」标签仍在(待发送集未被消费);模型回复不会按「Annotation 1:…」逐条回应
  4. 期望:批注块 prepend 进草稿随消息发出,发送后标签消失(README 交互流「回车随消息发送」)

预期结果

批注块(编号 + 原文 + 批注内容)+ 输入框问题一起发给模型;发送成功后「批注 ×N」标签清空;用户气泡只显示问题 + 「批注 ×N」。

根因(已定位,附源码证据)

client.jsonKeyDown(1092-1124)拼稿入口有硬性守卫:

if (e.key === 'Enter' && !e.shiftKey && !e.altKey
  && ui.quotes.length > 0 && !isImeKeyBlocked(e)) {
  var ta = e.target
  if (ta instanceof HTMLTextAreaElement && ta.closest('[data-composer-card]') !== null) {
    var attached = attachAndSend(e)
    ...
  }
}

0.1.2-alpha.1(DSH Desktop 2.0.4)的 composer 输入区已不是 <textarea>:内核 @deepseek-ai/dsh-client-ui-conversation 的输入机重构为 Lexical 编辑器,输入宿主是 div[contenteditable][data-composer-input](lib/client.js:14432-14463 "The composer's contenteditable host: binds one shell-owned Lexical editor";10701 行注释亦自称 "of the old textarea")。按 Enter 时 e.target 是 contenteditable div,ta instanceof HTMLTextAreaElement 恒为 false → 拼稿分支从不执行 → 批注块永不拼入草稿;待发送集从未被消费,所以「批注 ×N」一直在、不丢失。橡皮筋验证:onSendPointerDown(1149-1158)走 sendButtonOf 的 button[aria-label] 匹配、不依赖 textarea 守卫——鼠标点「发送消息」按钮理论上仍能拼稿,与"只按 Enter 必现"一致。

v1.4.4 声称适配 0.1.2-alpha.1,但仅验证了安装自检/启动图登记;Enter 拼稿走的仍是 textarea 时代的守卫,未适配 Lexical 输入区,属适配遗漏。

冒烟验证

引用代码

  • 插件端:client.js onKeyDown(1092-1124,textarea 守卫在 1112)、attachAndSend(1465-1499)、onSendPointerDown(1149-1158)
  • 内核端:@deepseek-ai/dsh-client-ui-conversation Lexical 输入宿主(lib/client.js:14432-14463,data-composer-input)、SessionInputShell(11342 起)

建议修复方向

  • 入口守卫扩展为同时匹配 contenteditable 宿主:e.target instanceof HTMLElement && e.target.closest('[data-composer-input]')(或匹配 [contenteditable="true"])且位于 [data-composer-card] 内;
  • Lexical 内 Enter 的默认行为需确认(editor.update 换行 vs 提交),拼稿仍走 shell.setDraft + 放行 composer 提交即可(shell 输入机 0.1.2 的 setDraft/submit 契约已确认存在,见 SessionInputShell.actions);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions