@@ -2,13 +2,20 @@ use std::path::PathBuf;
22
33use hypr_listener2_core:: { BatchEvent , BatchParams , BatchProvider , BatchRuntime } ;
44use hypr_local_model:: { CactusSttModel , LocalModel } ;
5+ #[ cfg( any( target_arch = "arm" , target_arch = "aarch64" ) ) ]
56use hypr_local_stt_server:: LocalSttServer ;
67use tokio:: sync:: mpsc;
78
89use crate :: cli:: Provider ;
910use crate :: config:: paths;
1011use crate :: error:: { CliError , CliResult , did_you_mean} ;
1112
13+ #[ cfg( any( target_arch = "arm" , target_arch = "aarch64" ) ) ]
14+ pub ( crate ) type ServerGuard = Option < hypr_local_stt_server:: LocalSttServer > ;
15+
16+ #[ cfg( not( any( target_arch = "arm" , target_arch = "aarch64" ) ) ) ]
17+ pub ( crate ) type ServerGuard = ( ) ;
18+
1219pub struct SttGlobalArgs {
1320 pub provider : Provider ,
1421 pub base_url : Option < String > ,
@@ -67,6 +74,7 @@ impl Provider {
6774 }
6875}
6976
77+ #[ cfg( any( target_arch = "arm" , target_arch = "aarch64" ) ) ]
7078pub struct CactusServerInfo {
7179 pub server : LocalSttServer ,
7280 pub base_url : String ,
@@ -79,7 +87,7 @@ pub struct ResolvedSttConfig {
7987 pub api_key : String ,
8088 pub model : String ,
8189 pub language : hypr_language:: Language ,
82- pub server : Option < LocalSttServer > ,
90+ pub server : ServerGuard ,
8391}
8492
8593impl ResolvedSttConfig {
@@ -124,6 +132,7 @@ pub async fn resolve_config(
124132
125133 let batch_provider = provider. to_batch_provider ( ) ;
126134
135+ #[ cfg( any( target_arch = "arm" , target_arch = "aarch64" ) ) ]
127136 if provider. is_local ( ) {
128137 let info = resolve_and_spawn_cactus ( model. as_deref ( ) ) . await ?;
129138 return Ok ( ResolvedSttConfig {
@@ -152,7 +161,7 @@ pub async fn resolve_config(
152161 api_key,
153162 model : model. unwrap_or_default ( ) ,
154163 language,
155- server : None ,
164+ server : ServerGuard :: default ( ) ,
156165 } ) ;
157166 }
158167
@@ -167,10 +176,11 @@ pub async fn resolve_config(
167176 api_key,
168177 model : model. unwrap_or_default ( ) ,
169178 language,
170- server : None ,
179+ server : ServerGuard :: default ( ) ,
171180 } )
172181}
173182
183+ #[ cfg( any( target_arch = "arm" , target_arch = "aarch64" ) ) ]
174184pub async fn resolve_and_spawn_cactus ( model_name : Option < & str > ) -> CliResult < CactusServerInfo > {
175185 let ( model, model_path) = resolve_cactus_model ( model_name) ?;
176186
0 commit comments