summaryrefslogtreecommitdiff
path: root/makima/src
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src')
-rw-r--r--makima/src/bin/makima.rs34
-rw-r--r--makima/src/daemon/cli/server.rs49
-rw-r--r--makima/src/server/state.rs37
3 files changed, 73 insertions, 47 deletions
diff --git a/makima/src/bin/makima.rs b/makima/src/bin/makima.rs
index 338d8f9..a84c581 100644
--- a/makima/src/bin/makima.rs
+++ b/makima/src/bin/makima.rs
@@ -42,13 +42,33 @@ async fn run_server(
eprintln!("=== Makima Server Starting ===");
eprintln!("Port: {}", args.port);
- // Create app state
- let mut app_state = makima::server::state::AppState::new(
- &args.parakeet_model_dir,
- &args.parakeet_eou_dir,
- &args.sortformer_model_path,
- &args.chatterbox_model_dir,
- );
+ // Create app state. ML model paths are optional now — when none of
+ // them are supplied (the slim Dockerfile case) Listen and Speak
+ // websocket endpoints respond with "not configured" and everything
+ // else works normally.
+ let mut app_state = match (
+ args.parakeet_model_dir.as_deref(),
+ args.parakeet_eou_dir.as_deref(),
+ args.sortformer_model_path.as_deref(),
+ args.chatterbox_model_dir.as_deref(),
+ ) {
+ (Some(p), Some(eou), Some(sf), Some(cb)) => {
+ eprintln!("ML models configured (lazy load on first use)");
+ makima::server::state::AppState::new(p, eou, sf, cb)
+ }
+ (None, None, None, None) => {
+ eprintln!("ML models NOT configured — Listen/Speak disabled");
+ makima::server::state::AppState::new_slim()
+ }
+ _ => {
+ eprintln!(
+ "WARNING: only some ML model paths provided. Pass all four \
+ (parakeet/parakeet_eou/sortformer/chatterbox) to enable ML, \
+ or none to run in slim mode. Continuing in slim mode."
+ );
+ makima::server::state::AppState::new_slim()
+ }
+ };
// Connect to database if URL provided
if let Some(ref db_url) = args.database_url {
diff --git a/makima/src/daemon/cli/server.rs b/makima/src/daemon/cli/server.rs
index adb765d..667f9ea 100644
--- a/makima/src/daemon/cli/server.rs
+++ b/makima/src/daemon/cli/server.rs
@@ -3,39 +3,34 @@
use clap::Args;
/// Run the makima server.
+///
+/// ML model paths (parakeet / sortformer / chatterbox) are optional. When
+/// none are provided the server still starts; the Listen and Speak websocket
+/// endpoints just return a "not configured" error if a client tries to use
+/// them. This is the supported way to run a slim deployment of makima
+/// without the LLM/STT/TTS dependencies — see `Dockerfile` (slim) vs
+/// `Dockerfile.full` (with models).
#[derive(Args, Debug)]
pub struct ServerArgs {
/// Server port
#[arg(long, env = "PORT", default_value = "8080")]
pub port: u16,
- /// Path to parakeet model directory
- #[arg(
- long,
- env = "PARAKEET_MODEL_DIR",
- default_value = "models/parakeet-tdt-0.6b-v3"
- )]
- pub parakeet_model_dir: String,
-
- /// Path to parakeet EOU model directory
- #[arg(
- long,
- env = "PARAKEET_EOU_DIR",
- default_value = "models/realtime_eou_120m-v1-onnx"
- )]
- pub parakeet_eou_dir: String,
-
- /// Path to sortformer model
- #[arg(
- long,
- env = "SORTFORMER_MODEL_PATH",
- default_value = "models/diarization/diar_streaming_sortformer_4spk-v2.1.onnx"
- )]
- pub sortformer_model_path: String,
-
- /// Path to Chatterbox TTS model directory
- #[arg(long, env = "CHATTERBOX_MODEL_DIR", default_value = "models/chatterbox-turbo")]
- pub chatterbox_model_dir: String,
+ /// Path to parakeet model directory (optional; STT disabled when unset).
+ #[arg(long, env = "PARAKEET_MODEL_DIR")]
+ pub parakeet_model_dir: Option<String>,
+
+ /// Path to parakeet EOU model directory (optional).
+ #[arg(long, env = "PARAKEET_EOU_DIR")]
+ pub parakeet_eou_dir: Option<String>,
+
+ /// Path to sortformer model (optional; diarization disabled when unset).
+ #[arg(long, env = "SORTFORMER_MODEL_PATH")]
+ pub sortformer_model_path: Option<String>,
+
+ /// Path to Chatterbox TTS model directory (optional; TTS disabled when unset).
+ #[arg(long, env = "CHATTERBOX_MODEL_DIR")]
+ pub chatterbox_model_dir: Option<String>,
/// PostgreSQL connection URI
#[arg(long, env = "POSTGRES_CONNECTION_URI")]
diff --git a/makima/src/server/state.rs b/makima/src/server/state.rs
index 6bd9e2b..e267da1 100644
--- a/makima/src/server/state.rs
+++ b/makima/src/server/state.rs
@@ -691,21 +691,37 @@ pub struct AppState {
}
impl AppState {
+ /// Create AppState WITHOUT ML model configuration. Listen and Speak
+ /// endpoints will return "not configured" errors if used; everything
+ /// else (mesh, directives, files, contracts-free CRUD) works normally.
+ /// This is the constructor used by the slim Dockerfile.
+ pub fn new_slim() -> Self {
+ Self::new_inner(None)
+ }
+
/// Create AppState with ML model configuration for lazy loading.
+ /// Pass None to disable a specific model family — Listen needs all
+ /// three of parakeet/parakeet_eou/sortformer; Speak needs chatterbox.
+ /// If `parakeet_model_dir` is None we skip the whole ModelConfig and
+ /// behave like `new_slim()`.
///
- /// Models are NOT loaded at startup - they will be loaded on first Listen connection.
- ///
- /// # Arguments
- /// * `parakeet_model_dir` - Path to the Parakeet TDT model directory
- /// * `parakeet_eou_dir` - Path to the Parakeet EOU model directory
- /// * `sortformer_model_path` - Path to the Sortformer diarization model file
- /// * `chatterbox_model_dir` - Path to the Chatterbox TTS model directory
+ /// Models are NOT loaded at startup — they're loaded on first use.
pub fn new(
parakeet_model_dir: &str,
parakeet_eou_dir: &str,
sortformer_model_path: &str,
chatterbox_model_dir: &str,
) -> Self {
+ Self::new_inner(Some(ModelConfig {
+ parakeet_model_dir: parakeet_model_dir.to_string(),
+ parakeet_eou_dir: parakeet_eou_dir.to_string(),
+ sortformer_model_path: sortformer_model_path.to_string(),
+ chatterbox_model_dir: chatterbox_model_dir.to_string(),
+ }))
+ }
+
+ /// Internal constructor — model_config can be None for the slim build.
+ fn new_inner(model_config: Option<ModelConfig>) -> Self {
// Create broadcast channels with buffer for 256 messages
let (file_updates, _) = broadcast::channel(256);
let (task_updates, _) = broadcast::channel(256);
@@ -744,12 +760,7 @@ impl AppState {
};
Self {
- model_config: Some(ModelConfig {
- parakeet_model_dir: parakeet_model_dir.to_string(),
- parakeet_eou_dir: parakeet_eou_dir.to_string(),
- sortformer_model_path: sortformer_model_path.to_string(),
- chatterbox_model_dir: chatterbox_model_dir.to_string(),
- }),
+ model_config,
ml_models: OnceCell::new(),
db_pool: None,
file_updates,