Skip to main content

clawft_plugin/voice/
config.rs

1//! Voice-specific configuration helpers.
2//!
3//! Re-exports `VoiceConfig` from `clawft-types` and provides
4//! runtime configuration for the voice pipeline.
5
6/// Runtime configuration for the voice pipeline.
7/// Wraps the serializable VoiceConfig with runtime state.
8#[derive(Debug, Clone)]
9pub struct VoicePipelineConfig {
10    /// Model cache directory path.
11    pub model_cache_dir: std::path::PathBuf,
12    /// Whether voice pipeline is active.
13    pub active: bool,
14}
15
16impl Default for VoicePipelineConfig {
17    fn default() -> Self {
18        Self {
19            model_cache_dir: default_model_cache_dir(),
20            active: false,
21        }
22    }
23}
24
25fn default_model_cache_dir() -> std::path::PathBuf {
26    // Use ~/.clawft/models/voice/ as default
27    if let Some(home) = dirs_fallback() {
28        home.join(".clawft").join("models").join("voice")
29    } else {
30        std::path::PathBuf::from(".clawft/models/voice")
31    }
32}
33
34fn dirs_fallback() -> Option<std::path::PathBuf> {
35    std::env::var("HOME").ok().map(std::path::PathBuf::from)
36}