Skip to content

feat(fcitx5): 润色期间按空格直接上屏粗识别文本 - #71

Open
zhanglongqi wants to merge 1 commit into
LeonardNJU:masterfrom
zhanglongqi:feat/polish-accept-rough
Open

zhanglongqi wants to merge 1 commit into
LeonardNJU:masterfrom
zhanglongqi:feat/polish-accept-rough

Conversation

@zhanglongqi

Copy link
Copy Markdown

Shift+F9 润色期间,如果粗识别文本已经满足需要,之前只能等润色完成,或者按键取消后粗识别文本也一并丢弃。本次在 Fcitx 5 中加入:润色期间按空格,取消润色任务并直接上屏粗识别文本,面板提示相应改为「粗识别文本(空格采用):」。

空格在粗识别结果到达之前按下时(松开快捷键后的短暂缓冲期、识别任务启动中、首次轮询前),不再取消润色并把按键漏给应用,而是记住请求,粗识别文本一到就上屏;润色失败或被取消时同样上屏粗识别文本。Esc 和其他按键的取消行为、普通 F9 的行为均不变。

选用空格而不是回车:如果按键稍晚、润色结果已经上屏,回车会作为换行传给应用,在聊天框或终端中等于直接发送;空格最多多出一个空格。这也与润色失败后后备结果可用空格采用的交互一致。

验证情况:

  1. 在 Xvfb 中隔离运行一个 Fcitx 5 实例和 GTK 文本框,用 xdotool 模拟按键,用替身录音程序提供固定的合成语音,经真实后台服务和 AI 端点润色。松开 Shift+F9 后 0.05、0.2、0.4、0.7、1.0 秒按空格,均上屏粗识别文本且无多余字符;润色完成后按空格只追加空格;润色期间按 Esc 不上屏,按回车保持原有取消行为。
  2. 修改前在同一环境中复现:粗识别结果到达前按键会取消润色并把按键传给应用,导致「有时能上屏、有时不能」。
  3. Fcitx 5 模块 Release 构建通过,并已在本机 KDE 会话中安装使用。
  4. scripts/test/contracts.sh 在跳过已知的「禁止 Python 源码」检查(与受版本控制的 scripts/test/ibus-shift-integration.py 冲突,见 fix(linux): 修复用户安装后缺少设置菜单入口及图标的问题 #70)后全部通过。
  5. 仅修改 Fcitx 5:IBus 的润色面板不显示粗识别文本,未包含在本次改动中。

Pressing Space during Shift+F9 polishing now commits the rough ASR text
and cancels the polish task. If the key arrives before the rough text
(release grace window, transcription start, or first poll), the request
is remembered and the text is committed as soon as it lands, instead of
cancelling and leaking the key to the application.

Space rather than Enter: a press that lands just after the polished
result was committed only adds a space instead of submitting a message.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

This branch has not been deployed

No deployments
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