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
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ members = [
]
exclude = [
"plugins/apple-calendar",
"plugins/apple-contact",
"plugins/cli2",
"plugins/db",
"plugins/extensions",
"plugins/pdf",
"crates/vad-ext",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub(super) async fn try_restart_recorder(
let cell = spawn_with_retry(&RETRY_STRATEGY, || {
let sup = sup.clone();
let ctx = ctx.clone();
async move { Ok(spawn_recorder(sup, &ctx).await?) }
async move { spawn_recorder(sup, &ctx).await }
})
.await;

Expand Down
9 changes: 4 additions & 5 deletions crates/owhisper-client/src/adapter/cactus/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,13 @@ impl<S> SseParserState<S> {
&mut self,
response: StreamResponse,
) -> Option<Result<StreamingBatchEvent, Error>> {
if let StreamResponse::TranscriptResponse { channel, .. } = &response {
if channel
if let StreamResponse::TranscriptResponse { channel, .. } = &response
&& channel
.alternatives
.first()
.is_some_and(|a| !a.words.is_empty())
{
self.saw_segment_words = true;
}
{
self.saw_segment_words = true;
}

let segment_end = match &response {
Expand Down
6 changes: 3 additions & 3 deletions crates/owhisper-client/src/adapter/soniox/live.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,9 @@ fn build_words(tokens: &[&soniox::Token]) -> Vec<owhisper_interface::stream::Wor
.collect()
}

fn partition_tokens_by_word_finality<'a>(
tokens: &'a [soniox::Token],
) -> (Vec<&'a soniox::Token>, Vec<&'a soniox::Token>) {
fn partition_tokens_by_word_finality(
tokens: &[soniox::Token],
) -> (Vec<&soniox::Token>, Vec<&soniox::Token>) {
let mut final_tokens = Vec::new();
let mut non_final_tokens = Vec::new();
for group in token_groups_from_values(tokens) {
Expand Down
12 changes: 6 additions & 6 deletions crates/transcript/src/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ pub fn render_speaker_label(
return human_id.clone();
}

if key.channel == ChannelProfile::DirectMic {
if let Some(self_human_id) = ctx.self_human_id.as_ref() {
if let Some(name) = ctx.human_name_by_id.get(self_human_id) {
return name.clone();
}
return "You".to_string();
if key.channel == ChannelProfile::DirectMic
&& let Some(self_human_id) = ctx.self_human_id.as_ref()
{
if let Some(name) = ctx.human_name_by_id.get(self_human_id) {
return name.clone();
}
return "You".to_string();
}
} else if let Some(human_id) = key.speaker_human_id.as_ref() {
return human_id.clone();
Expand Down
8 changes: 4 additions & 4 deletions crates/transcript/src/segments/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ fn determine_key(
segments: &[ProtoSegment],
last_segment_by_channel: &HashMap<ChannelProfile, usize>,
) -> SegmentKey {
if !frame.word.is_final {
if let Some(&index) = last_segment_by_channel.get(&frame.word.channel) {
return segments[index].key.clone();
}
if !frame.word.is_final
&& let Some(&index) = last_segment_by_channel.get(&frame.word.channel)
{
return segments[index].key.clone();
}

create_segment_key(frame.word.channel, frame.identity.as_ref())
Expand Down
42 changes: 21 additions & 21 deletions crates/transcript/src/segments/speakers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,29 @@ fn apply_identity_rules(
) -> SpeakerIdentity {
let mut identity = assignment.cloned().unwrap_or_default();

if identity.speaker_index.is_some() && identity.human_id.is_none() {
if let Some(speaker_index) = identity.speaker_index {
if let Some(human_id) = state.human_id_by_speaker_index.get(&speaker_index) {
identity.human_id = Some(human_id.clone());
}
}
if identity.speaker_index.is_some()
&& identity.human_id.is_none()
&& let Some(speaker_index) = identity.speaker_index
&& let Some(human_id) = state.human_id_by_speaker_index.get(&speaker_index)
{
identity.human_id = Some(human_id.clone());
}

if identity.human_id.is_none() && state.complete_channels.contains(&word.channel) {
if let Some(human_id) = state.human_id_by_channel.get(&word.channel) {
identity.human_id = Some(human_id.clone());
}
if identity.human_id.is_none()
&& state.complete_channels.contains(&word.channel)
&& let Some(human_id) = state.human_id_by_channel.get(&word.channel)
{
identity.human_id = Some(human_id.clone());
}

if !word.is_final && !(identity.speaker_index.is_some() && identity.human_id.is_some()) {
if let Some(last) = state.last_speaker_by_channel.get(&word.channel) {
if identity.speaker_index.is_none() {
identity.speaker_index = last.speaker_index;
}
if identity.human_id.is_none() {
identity.human_id = last.human_id.clone();
}
if !(word.is_final || identity.speaker_index.is_some() && identity.human_id.is_some())
&& let Some(last) = state.last_speaker_by_channel.get(&word.channel)
{
if identity.speaker_index.is_none() {
identity.speaker_index = last.speaker_index;
}
if identity.human_id.is_none() {
identity.human_id = last.human_id.clone();
}
}

Expand All @@ -165,10 +166,9 @@ fn remember_identity(
if state.complete_channels.contains(&word.channel)
&& identity.human_id.is_some()
&& identity.speaker_index.is_none()
&& let Some(human_id) = identity.human_id.clone()
{
if let Some(human_id) = identity.human_id.clone() {
state.human_id_by_channel.insert(word.channel, human_id);
}
state.human_id_by_channel.insert(word.channel, human_id);
}

if (!word.is_final || identity.speaker_index.is_some() || has_explicit_assignment)
Expand Down
Loading