Skip to content

fix(selection): 拒绝用截断提示替换超长选区 - #1139

Draft
cursor[bot] wants to merge 1 commit into
betafrom
cursor/critical-bug-identification-c6d1
Draft

cursor[bot] wants to merge 1 commit into
betafrom
cursor/critical-bug-identification-c6d1

Conversation

@cursor

@cursor cursor Bot commented Oct 3, 2026

Copy link
Copy Markdown

摘要

Fixes #。

选区润色和语音编辑在选区超过 16000 字时,不再把模型只看到的前缀写回整段原文。

修复 / 新增 / 改进

  • 选区润色和语音编辑(含翻译重写)的提示信封最多放入 16000 字,但默认直接替换会用模型输出覆盖整段选区。模型没看到的后半段会被删掉。
  • 超过上限时在调用模型之前返回 InvalidArgument,原文保持不动。正好 16000 字的选区仍可润色。不走模型的原文直通不受影响。

兼容

  • 不包含:提示截断策略本身、问答路径(问答不替换选区)。
  • 对现有用户 / 本地环境 / 构建流程的影响:超过 16000 字的选区润色或语音编辑会失败并保留原文,而不再静默删掉后半段。

测试计划

  • 命令:cargo +1.88.0 test -p openless-core --test selection_contract --test selection_voice_contract oversized_
  • 结果:2 passed
  • 证据路径:openless-all/app/crates/openless-core/tests/selection_contract.rs、openless-all/app/crates/openless-core/tests/selection_voice_contract.rs
Open in Web View Automation 

选区润色和语音编辑的提示最多只放入 16000 字,但默认直接替换会把模型结果写回整段原文。超长选区在调用模型前直接失败,避免删掉模型没看到的后半段。

Co-authored-by: lubaiqing9 <lubaiqing9@gmail.com>
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