Repository navigation
Conversation
The suggestion bubble only accepts the text into the composer, so sending a suggestion always costs a second tap on the send button, and accepting first hides the bubble because it is gated on an empty editor. Keep the bubble as the accept affordance and add a trailing control that submits the suggestion directly. The send path reuses the existing submission handler with an explicit text override, so toast/queue/error handling stays in one place, and the draft is left untouched — a half-typed message must never be clobbered by a suggestion. Covered by the existing prompt-suggestion browser fixture plus a new case asserting one tap records a send and does not fill the textarea. iOS, Android and HarmonyOS composers still accept-only; this change covers the Remote web surface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Remote 端聊天页的建议气泡(prompt suggestion)只有一个动作:把建议文本填进输入框。
这在触屏上要两次点击才能发出去 —— 第一次点气泡、第二次点发送键。而且点完气泡它立刻消失(显示条件是「输入框为空」),第二次点击的落点还换了地方。
桌面端有
Tab键可以先落到输入框再随手回车,触屏没有对应物。改动
气泡主体保持原行为(只填入、不发送),旁边新增一个独立的发送控件,一步直达:
实现上复用现有提交通道,没有新开一条发送路径:
handleSend增加一个可选的显式文本参数,onClick传进来的事件对象会被类型判断挡掉(typeof === 'string'),所以原有的onSend={handleSend}语义不变。草稿保护:本来清理草稿的逻辑是「发送成功后,如果输入框内容没被改过就清空」。一键发送时草稿根本没参与,所以这条清理被跳过 —— 用户打了一半的内容不会被建议顶掉。
具体文件
src/mobile-web/src/components/ChatComposerBar.tsxonSendPromptSuggestionsrc/mobile-web/src/pages/ChatPage.tsxhandleSend支持显式文本,接通onSendPromptSuggestionsrc/mobile-web/src/styles/components/chat-input.scsssrc/mobile-web/src/i18n/messages.tschat.promptSuggestionSend(en / zh-CN / zh-TW)src/mobile-web/tests/fixtures/prompt-suggestion.tsxsrc/mobile-web/tests/prompt-suggestion-browser.test.mjs验证
两条都通过;原有的「气泡布局在 320/390/768/1200 下不溢出、点击只采纳不提交」用例仍然通过,说明默认交互没有被改坏。
范围
只改 Remote web 端。iOS / Android / HarmonyOS 的原生 composer 目前仍是「只采纳」,如果这个方向认可,可以按同样的语义跟进。