feat(remote-input): 远程输入可选转发本会话的实时识别文字 - #1147
Open
Francis-Zxp wants to merge 1 commit into
Open
Francis-Zxp wants to merge 1 commit into
Francis-Zxp wants to merge 1 commit into
Conversation
客户端在 hello 帧中发送 "partials": true 后,本连接自己开启的会话的
TranscriptDelta 会作为 {"type":"partial","text","offset","final"} 转发;
未请求的客户端(包括自带手机页面)消息不变,所有权规则不变。
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.
摘要
无关联 issue。
远程输入(WebSocket)目前只把本会话的最终润色结果发给客户端。识别过程中的实时文字已经由
dictation_engine.rs的TranscriptProgressForwarder按会话发布为TranscriptDelta,但backend_event_to_phone没有转发它。本 PR 让客户端在 hello 帧里用"partials": true显式请求后,收到本会话的实时文字。背景:我在做一个通过远程输入接口接入 OpenLess 的 Windows 翻页笔语音工具,希望在自己的悬浮窗里边说边显示识别文字,现在只能等最终结果。
修复 / 新增 / 改进
remote_server/mod.rs:backend_event_to_phone新增wants_partials参数。为真时,把本会话的TranscriptDelta转发为{"type":"partial","text":…,"offset":…,"final":…}。offset的含义与TranscriptAccumulator::apply一致:从第 offset 个字符起替换。parse_hello_partials,与parse_hello_pin并列,只读取 hello 帧里这个可选布尔字段。兼容
assets/remote-input)的界面改动。"partials": true的客户端(包括自带手机页面)收到的消息完全不变。final文字和原有的result。测试计划
cargo test --manifest-path src-tauri/Cargo.toml --lib remote_server(Windows 11,Rust 1.95)。按 CI 的做法,先运行了scripts/ci-disable-macos-qwen3.mjs和scripts/prepare-windows-sherpa.ps1。21 passed; 0 failed,其中包括新增的websocket_forwards_live_transcript_only_when_asked_and_only_for_the_owned_session。它覆盖三种情况:未请求时不发送;其他会话不发送;本会话按 offset 发送,且不结束所有权。STATUS_ENTRYPOINT_NOT_FOUND(CI 在 Windows 上也只做--no-run)。本地用mt.exe给测试可执行文件嵌入清单后运行,上面的结果就来自这次运行。rustfmt --edition 2021已格式化改动文件。