fix(polish): 调整热词注入提示措辞#135
Conversation
The hotword injection copy now tells the model to prefer the user's spelling proactively while still avoiding unrelated mechanical replacements. That keeps the intent of issue Open-Less#63 aligned with the existing prompt structure and only changes the wording that users see indirectly through polish behavior. Constraint: Keep the change minimal and avoid changing the surrounding prompt architecture. Rejected: Broaden the prompt or add new prompt sections | unnecessary for this issue. Confidence: high Scope-risk: narrow Directive: Keep future hotword guidance user-facing and proactive, but still avoid blanket replacement language. Tested: cargo test --manifest-path src-tauri/Cargo.toml polish::tests -- --nocapture; cargo check --manifest-path src-tauri/Cargo.toml Not-tested: Live LLM output quality against the updated prompt wording.
There was a problem hiding this comment.
Sorry @H-Chris233, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The capsule window used a fixed oversized frame even when only the pill was visible, so transparent padding could block clicks on underlying apps. The runtime now resizes and repositions the capsule to the actual visible content, expanding only when the translation badge is shown. Constraint: Keep the fix minimal and preserve the translation badge when it is actually visible. Rejected: Add click-through behavior to transparent pixels | too risky and platform-specific for this narrow fix. Confidence: high Scope-risk: moderate Directive: Keep capsule window geometry in sync with rendered content; do not reintroduce a larger transparent hitbox without a matching click-through strategy. Tested: cargo test --manifest-path src-tauri/Cargo.toml --lib -- --nocapture; npm ci; npm run build; git diff --check Not-tested: Live mouse hit-testing on Windows/macOS/Linux after the resize change.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f62762a17f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
QA positioning had kept its own fixed capsule height constant after the capsule window was resized to match the visible pill. Reusing the shared capsule height source keeps the documented gap intact without widening the change surface. Constraint: Keep the change minimal and avoid a separate geometry model for QA. Rejected: Keep the old QA constant | would drift from the new capsule geometry again. Confidence: high Scope-risk: narrow Directive: If capsule geometry changes again, update QA anchoring from the shared capsule source instead of introducing another fixed constant. Tested: cargo test --manifest-path src-tauri/Cargo.toml --lib -- --nocapture Not-tested: Live QA window placement on each platform.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 320c97485c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let show_capsule = inner.prefs.get().show_capsule; | ||
| if let Some(window) = app.get_webview_window("capsule") { | ||
| let visible = !matches!(state, CapsuleState::Idle); | ||
| let _ = crate::position_capsule_bottom_center(&window, payload.translation); |
There was a problem hiding this comment.
Avoid resizing capsule on every level tick
emit_capsule now calls position_capsule_bottom_center unconditionally, which performs both set_size and set_position each time this function runs. In this codepath, recording level updates are emitted about every 33ms (see the LEVEL_EMIT_MIN_INTERVAL_MS throttled handlers in coordinator.rs), so this change turns steady-state recording into repeated native resize/reposition operations even when size/monitor/translation state has not changed. That can add avoidable compositor churn and visible jitter on long recordings; it would be safer to only resize/reposition when translation mode or monitor actually changes.
Useful? React with 👍 / 👎.
The capsule window now tracks its last applied geometry and only resizes/repositions when the monitor or translation state actually changes. That keeps steady-state level updates from churning the native window manager while preserving the current placement behavior when geometry really does change. Constraint: Keep the fix minimal and avoid introducing a broader window-management abstraction. Rejected: Leave the unconditional relayout in place | it adds avoidable compositor churn during recording. Confidence: high Scope-risk: narrow Directive: Any future capsule geometry change should update the cached geometry key, not reintroduce unconditional relayout. Tested: cargo test --manifest-path src-tauri/Cargo.toml --lib -- --nocapture Not-tested: Live compositor/jitter behavior on Windows/macOS/Linux.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1dfcf7f302
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| *last = Some(next); | ||
| drop(last); | ||
| let _ = crate::position_capsule_bottom_center(window, translation_active); |
There was a problem hiding this comment.
Update layout cache only after successful reposition
maybe_position_capsule_bottom_center records last = Some(next) before attempting position_capsule_bottom_center, and then discards the result. If set_size/set_position fails once (for example during transient window-state/platform errors), later emits with the same monitor/translation state will be skipped forever because the cache says layout is already applied, leaving the capsule stuck at stale size/position until some unrelated state change occurs.
Useful? React with 👍 / 👎.
The capsule geometry cache must reflect only applied layout, otherwise a transient resize or position failure would permanently suppress future retries for the same monitor and translation state. The cache is now written only after the relayout call succeeds, so a failed attempt can be retried on later emits. Constraint: Keep the fix local to the capsule relayout path. Rejected: Cache before calling relayout | can strand the capsule on stale geometry after a transient failure. Confidence: high Scope-risk: narrow Directive: Never treat capsule geometry as applied until the window manager has accepted the resize/reposition. Tested: cargo test --manifest-path src-tauri/Cargo.toml --lib -- --nocapture Not-tested: Live retry behavior under actual window-manager failures.
摘要
Fixes #63。
本 PR 按最小改动调整 polish 热词注入提示词措辞。
此前
compose_system_prompt中热词列表的说明是“仅当原始转写明显是其误识别时才纠正”,语气偏保守,容易让模型把用户词汇本理解成“错了才改”,而不是“这些是用户希望优先保持准确的写法”。本次改动将热词提示改为更主动的表达:用户希望这些写法在输出中保持准确;当转写中出现这些词的同音 / 近形误识别时,优先按上述写法输出。同时继续保留“不做无关词机械替换”的约束,避免扩大到无关文本替换。
修复 / 新增 / 改进
调整
polish.rs::compose_system_prompt中热词注入文案。将热词说明从偏被动的“仅当明显误识别时才纠正”调整为:
保持现有 prompt 结构不变。
不新增 prompt 段落。
不扩大 polish 提示词架构。
新增测试覆盖:
兼容
不包含:
对现有用户 / 本地环境 / 构建流程的影响:
测试计划
命令:
cargo test --manifest-path openless-all/app/src-tauri/Cargo.toml polish::tests -- --nocapture结果:通过
证据路径:本地测试输出
命令:
cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml结果:通过
证据路径:本地检查输出
主要改动文件
openless-all/app/src-tauri/src/polish.rs备注
本 PR 只调整热词注入提示词的措辞强度,没有改变 surrounding prompt architecture。真实 LLM 输出质量仍需要后续用实际模型回归观察。