Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions openless-all/app/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ windows = { version = "0.58", features = [
"Win32_Media_Audio_Endpoints",
"Win32_Storage_FileSystem",
"Win32_System_Com",
"Win32_System_DataExchange",
"Win32_System_Ole",
"Win32_System_Registry",
"Win32_System_Threading",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,14 @@ pub(super) async fn run_selection_polish(inner: &Arc<Inner>) -> Result<(), Strin
// final check below deliberately does *not* restore this target: a user who
// changed windows made an intentional context switch, so the safe behavior
// is to leave both apps untouched.
let (selection_opt, insertion_target) = crate::selection::resolve_selection_workspace_capture();
let (selection_opt, insertion_target, capture_diag) =
crate::selection::resolve_selection_workspace_capture_with_diag();
if selection_polish_plan(selection_opt.as_ref()) == SelectionPolishPlan::NoSelection {
let code = "selectionPolishNoSelection";
log::warn!(
"[selection-polish] no selection ({})",
capture_diag.summary()
);
finish_selection_polish_capsule(
inner,
CapsuleState::Cancelled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use super::{
answer_qa_question_text, capture_external_focus_target, close_qa_panel, emit_capsule,
open_qa_panel, polish_text, qa_event_target, qa_session, restore_focus_target_if_possible,
schedule_capsule_idle, translate_text, CapsuleFeedback, Coordinator, Inner, QaPhase,
CAPSULE_AUTO_HIDE_DELAY_MS,
};
use crate::coordinator_state::{initial_session_id, new_session_id, SessionId};
use crate::edit_plan::{apply_edit_plan, parse_edit_plan, EditOperation, EditPlan};
Expand Down Expand Up @@ -64,6 +65,11 @@ fn emit_selection_voice_begin_error(inner: &Arc<Inner>, error: &str) {
Some(selection_voice_user_message(error)),
None,
);
// 无选区等 begin 失败时胶囊会停在 Error;与听写 Done/Error 同口径,2s 后自动收回。
schedule_capsule_idle(inner, CAPSULE_AUTO_HIDE_DELAY_MS);
log::info!(
"[selection-voice] begin error capsule shown error={error} auto_hide_ms={CAPSULE_AUTO_HIDE_DELAY_MS}"
);
}

fn emit_selection_voice_end_error(inner: &Arc<Inner>, error: &str) {
Expand Down Expand Up @@ -388,9 +394,27 @@ async fn begin_selection_voice_session(inner: &Arc<Inner>) -> Result<(), String>
return Err("selectionVoiceBusy".into());
}

let (selection_opt, insertion_target) = crate::selection::resolve_selection_workspace_capture();
let selection = selection_opt.ok_or_else(|| "selectionVoiceNoSelection".to_string())?;
let (selection_opt, insertion_target, capture_diag) =
crate::selection::resolve_selection_workspace_capture_with_diag();
log::info!(
"[selection-voice] begin capture diag={}",
capture_diag.summary()
);
let selection = match selection_opt {
Some(selection) => selection,
None => {
log::warn!(
"[selection-voice] begin failed: selectionVoiceNoSelection ({})",
capture_diag.summary()
);
return Err("selectionVoiceNoSelection".into());
}
};
if !crate::selection::selection_insertion_target_is_captured(&insertion_target) {
log::warn!(
"[selection-voice] begin failed: selectionVoiceTargetUnavailable ({})",
capture_diag.summary()
);
return Err("selectionVoiceTargetUnavailable".into());
}

Expand Down
Loading
Loading