Skip to content

Commit 80abb45

Browse files
{"schema":"decodex/commit/1","summary":"Fix non-macOS core build","authority":"manual"}
1 parent 21b61f2 commit 80abb45

3 files changed

Lines changed: 22 additions & 24 deletions

File tree

packages/voxit-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ voxit-realtime = ["dep:futures-util", "dep:http", "dep:tokio", "dep:tokio-tungst
1717
base64 = { workspace = true }
1818
directories = { workspace = true }
1919
futures-util = { workspace = true, optional = true }
20-
hound = { workspace = true }
2120
http = { workspace = true, optional = true }
2221
keyring = { workspace = true }
2322
reqwest = { workspace = true }
@@ -34,6 +33,7 @@ webbrowser = { workspace = true }
3433
[target.'cfg(target_os = "macos")'.dependencies]
3534
core-foundation = { workspace = true }
3635
core-foundation-sys = { workspace = true }
36+
hound = { workspace = true }
3737
objc2-foundation = { workspace = true }
3838
objc2-local-authentication = { workspace = true }
3939
security-framework-sys = { workspace = true }

packages/voxit-core/src/inference.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ use std::sync::mpsc::{Receiver, Sender};
44
#[cfg(target_os = "macos")] use std::{collections::BTreeMap, time::Instant};
55

66
#[cfg(target_os = "macos")]
7-
use crate::providers::{self, InferenceProvider, RewriteRequest, TranscriptionRequest};
87
use crate::{
9-
ContextualVoiceRouter, FocusedAppContext, VoiceSessionPlan,
10-
providers::chatgpt::ChatGptProvider,
8+
ContextualVoiceRouter, FocusedAppContext,
9+
providers::{
10+
self, InferenceProvider, RewriteRequest, TranscriptionRequest, chatgpt::ChatGptProvider,
11+
},
12+
};
13+
use crate::{
14+
VoiceSessionPlan,
1115
realtime::{RealtimeError, RealtimeEvent, RealtimeSession, RealtimeSessionConfig},
1216
};
1317
use voxit_audio::AudioChunk;
@@ -103,7 +107,7 @@ pub fn start_realtime_session(
103107
let _ = chunk_rx;
104108
let _ = event_tx;
105109

106-
Err(RealtimeError::DependencyUnavailable {
110+
Err(RealtimeError::RuntimeError {
107111
reason: "inference pipeline is only enabled on macOS builds".to_string(),
108112
})
109113
}

packages/voxit-core/src/realtime.rs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
//! Realtime transcription session helpers for Pass1 streaming.
22
3-
#[cfg(all(target_os = "macos", feature = "voxit-realtime"))] use std::time::Duration;
43
use std::{
54
fmt::{Display, Formatter},
6-
sync::{
7-
mpsc,
8-
mpsc::{Receiver, Sender},
9-
},
10-
thread::{self, JoinHandle},
5+
sync::mpsc::{Receiver, Sender},
6+
thread::JoinHandle,
117
};
8+
#[cfg(feature = "voxit-realtime")] use std::{sync::mpsc, thread, time::Duration};
129

1310
use base64::{Engine, engine::general_purpose::STANDARD};
14-
#[cfg(all(target_os = "macos", feature = "voxit-realtime"))]
15-
use futures_util::{SinkExt as _, StreamExt as _};
16-
use http::Request;
11+
#[cfg(feature = "voxit-realtime")] use futures_util::{SinkExt as _, StreamExt as _};
12+
#[cfg(feature = "voxit-realtime")] use http::Request;
1713
use serde_json::Value;
18-
#[cfg(all(target_os = "macos", feature = "voxit-realtime"))] use tokio::runtime::Runtime;
19-
use tokio::time;
20-
#[cfg(all(target_os = "macos", feature = "voxit-realtime"))]
21-
use tokio_tungstenite::tungstenite::protocol::Message;
14+
#[cfg(feature = "voxit-realtime")] use tokio::{runtime::Runtime, time};
15+
#[cfg(feature = "voxit-realtime")] use tokio_tungstenite::tungstenite::protocol::Message;
2216

2317
use crate::transcript::TranscriptEvent;
2418
use voxit_audio::AudioChunk;
@@ -82,7 +76,7 @@ pub enum RealtimeEvent {
8276
#[derive(Clone, Debug)]
8377
pub enum RealtimeError {
8478
/// Required websocket client feature is not enabled for this build.
85-
#[cfg(not(all(target_os = "macos", feature = "voxit-realtime")))]
79+
#[cfg(not(feature = "voxit-realtime"))]
8680
DependencyUnavailable {
8781
/// Human-readable reason.
8882
reason: String,
@@ -97,15 +91,15 @@ impl Display for RealtimeError {
9791
/// Format error to string.
9892
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
9993
match self {
100-
#[cfg(not(all(target_os = "macos", feature = "voxit-realtime")))]
94+
#[cfg(not(feature = "voxit-realtime"))]
10195
Self::DependencyUnavailable { reason } => write!(f, "{reason}"),
10296
Self::RuntimeError { reason } => write!(f, "{reason}"),
10397
}
10498
}
10599
}
106100

107101
/// Start a Pass1 websocket session and stream chunks to OpenAI Realtime.
108-
#[cfg(all(target_os = "macos", feature = "voxit-realtime"))]
102+
#[cfg(feature = "voxit-realtime")]
109103
pub fn start_realtime_session(
110104
api_key: String,
111105
account_id: Option<String>,
@@ -117,7 +111,7 @@ pub fn start_realtime_session(
117111
}
118112

119113
/// Start a Pass1 websocket session and stream chunks to OpenAI Realtime.
120-
#[cfg(not(all(target_os = "macos", feature = "voxit-realtime")))]
114+
#[cfg(not(feature = "voxit-realtime"))]
121115
pub fn start_realtime_session(
122116
api_key: String,
123117
account_id: Option<String>,
@@ -136,7 +130,7 @@ pub fn start_realtime_session(
136130
})
137131
}
138132

139-
#[cfg(all(target_os = "macos", feature = "voxit-realtime"))]
133+
#[cfg(feature = "voxit-realtime")]
140134
fn start_realtime_session_impl(
141135
api_key: String,
142136
account_id: Option<String>,
@@ -152,7 +146,7 @@ fn start_realtime_session_impl(
152146
Ok(RealtimeSession { stop_tx: Some(stop_tx), worker: Some(worker) })
153147
}
154148

155-
#[cfg(all(target_os = "macos", feature = "voxit-realtime"))]
149+
#[cfg(feature = "voxit-realtime")]
156150
fn run_realtime_worker(
157151
api_key: String,
158152
account_id: Option<String>,

0 commit comments

Comments
 (0)