Skip to content
Merged
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 numberDiff line numberDiff line change
Expand Up@@ -153,6 +153,7 @@ windows = { version = "0.58", features = [
"Win32_Security",
"Win32_Storage_FileSystem",
"Win32_System_Com",
"Win32_System_DataExchange",
"Win32_System_Diagnostics_ToolHelp",
"Win32_System_JobObjects",
"Win32_System_Ole",
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,7 @@

use std::sync::{Arc, Weak};

use super::{emit_capsule, schedule_capsule_idle, Coordinator, Inner};
use super::{emit_capsule, schedule_capsule_idle, Coordinator, Inner, CAPSULE_AUTO_HIDE_DELAY_MS};
use crate::coordinator_state::SessionId;
use crate::selection::SelectionInsertionTarget;
use crate::types::{CapsuleState, InsertStatus};
Expand DownExpand Up@@ -133,6 +133,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 DownExpand Up@@ -292,9 +297,27 @@ pub(super) async fn handle_selection_voice_released(inner: &Arc<Inner>) {
}

async fn begin_selection_voice_session(inner: &Arc<Inner>) -> Result<(), String> {
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