fix: Face processor now saves status and total_faces to face.json

This commit is contained in:
Accusys
2026-09-26 23:06:11 +08:00
parent 8a736a4103
commit 357e585399
99 changed files with 13881 additions and 1065 deletions
+65 -16
View File
@@ -44,6 +44,21 @@ pub fn set_auto_pipeline_enabled(enabled: bool) {
tracing::info!("Auto-pipeline enabled set to: {}", enabled);
}
pub static RUNTIME_PREFERRED_LANGUAGE: Lazy<RwLock<String>> = Lazy::new(|| {
let initial = env::var("MOMENTRY_PREFERRED_LANGUAGE")
.unwrap_or_else(|_| "zh-TW".to_string());
RwLock::new(initial)
});
pub fn get_preferred_language() -> String {
RUNTIME_PREFERRED_LANGUAGE.read().unwrap().clone()
}
pub fn set_preferred_language(language: String) {
*RUNTIME_PREFERRED_LANGUAGE.write().unwrap() = language.clone();
tracing::info!("Preferred language set to: {}", language);
}
// ─────────────────────────────────────────────────────────────
// Sensitive configs (always from ENV, never in JSON)
// ─────────────────────────────────────────────────────────────
@@ -124,31 +139,65 @@ pub static EMBED_URL: Lazy<String> = Lazy::new(|| {
});
pub static LLM_HEALTH_URL: Lazy<String> = Lazy::new(|| {
env::var("MOMENTRY_LLM_HEALTH_URL").unwrap_or_else(|_| {
"http://127.0.0.1:8080/health".to_string()
})
env::var("MOMENTRY_LLM_HEALTH_URL")
.unwrap_or_else(|_| "http://127.0.0.1:8080/health".to_string())
});
pub static SCENE_VLM_ENABLED: Lazy<bool> = Lazy::new(|| {
env::var("MOMENTRY_SCENE_VLM_ENABLED")
.map(|v| v == "true" || v == "1")
.unwrap_or(true) // Default: true (Scene VLM is mandatory, not optional)
});
pub static SCENE_VLM_INTERVAL: Lazy<u32> = Lazy::new(|| {
env::var("MOMENTRY_SCENE_VLM_INTERVAL")
.ok()
.and_then(|v| v.parse().ok())
.unwrap_or(10)
});
pub static SCENE_VLM_SAMPLES: Lazy<usize> = Lazy::new(|| {
env::var("MOMENTRY_SCENE_VLM_SAMPLES")
.ok()
.and_then(|v| v.parse().ok())
.unwrap_or(10)
});
pub static SCENE_VLM_USE_CUTS: Lazy<bool> = Lazy::new(|| {
env::var("MOMENTRY_SCENE_VLM_USE_CUTS")
.map(|v| v == "true" || v == "1")
.unwrap_or(true)
});
pub static SCENE_VLM_MAX_WORKERS: Lazy<usize> = Lazy::new(|| {
env::var("MOMENTRY_SCENE_VLM_MAX_WORKERS")
.ok()
.and_then(|v| v.parse().ok())
.unwrap_or(10)
});
pub fn get_scene_vlm_config() -> (bool, u32, usize, bool, usize) {
(
*SCENE_VLM_ENABLED,
*SCENE_VLM_INTERVAL,
*SCENE_VLM_SAMPLES,
*SCENE_VLM_USE_CUTS,
*SCENE_VLM_MAX_WORKERS,
)
}
// ─────────────────────────────────────────────────────────────
// JSON-backed configs (paths, concurrency, feature flags)
// These read from admin_config.json with ENV fallback
// ─────────────────────────────────────────────────────────────
pub static OUTPUT_DIR: Lazy<String> = Lazy::new(|| {
crate::core::admin_config::get_output_dir()
});
pub static OUTPUT_DIR: Lazy<String> = Lazy::new(|| crate::core::admin_config::get_output_dir());
pub static BACKUP_DIR: Lazy<String> = Lazy::new(|| {
crate::core::admin_config::get_backup_dir()
});
pub static BACKUP_DIR: Lazy<String> = Lazy::new(|| crate::core::admin_config::get_backup_dir());
pub static SCRIPTS_DIR: Lazy<String> = Lazy::new(|| {
crate::core::admin_config::get_scripts_dir()
});
pub static SCRIPTS_DIR: Lazy<String> = Lazy::new(|| crate::core::admin_config::get_scripts_dir());
pub static PYTHON_PATH: Lazy<String> = Lazy::new(|| {
crate::core::admin_config::get_python_path()
});
pub static PYTHON_PATH: Lazy<String> = Lazy::new(|| crate::core::admin_config::get_python_path());
pub static MEDIA_BASE_URL: Lazy<String> = Lazy::new(|| {
env::var("MOMENTRY_MEDIA_BASE_URL")
@@ -347,4 +396,4 @@ pub mod processor {
.map(|v| v == "true" || v == "1")
.unwrap_or(false)
});
}
}