fix: VLM output language configuration
問題: - admin_config.json 的 vlm_output_language 被忽略 - Worker 使用默認語言 (zh-TW) - VLM 輸出語言無法設置 修復: - ✅ SearchConfig 添加 vlm_output_language 字段 - ✅ Worker 讀取 admin_config 並設置語言 - ✅ Scene VLM 使用 preferred_language 配置優先級: 1. admin_config.json (最高) 2. MOMENTRY_PREFERRED_LANGUAGE 環境變數 3. 默認值 zh-TW 支持語言: - ja (日文) - en (英文) - zh-TW (繁體中文,默認) - zh-CN (簡體中文) - ko (韓文) 文檔: - docs_v1.0/M4_workspace/2026-09-28_vlm_output_language_fix.md 狀態: ✅ 已修復
This commit is contained in:
@@ -189,12 +189,15 @@ pub struct AdminSettings {
|
||||
pub struct SearchConfig {
|
||||
#[serde(default = "default_vlm_min_score")]
|
||||
pub vlm_min_score: f64,
|
||||
#[serde(default = "default_vlm_output_language")]
|
||||
pub vlm_output_language: String,
|
||||
}
|
||||
|
||||
impl Default for SearchConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
vlm_min_score: default_vlm_min_score(),
|
||||
vlm_output_language: default_vlm_output_language(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,6 +209,11 @@ fn default_vlm_min_score() -> f64 {
|
||||
.unwrap_or(0.0)
|
||||
}
|
||||
|
||||
fn default_vlm_output_language() -> String {
|
||||
std::env::var("MOMENTRY_PREFERRED_LANGUAGE")
|
||||
.unwrap_or_else(|_| "zh-TW".to_string())
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct FaceFilterDefaults {
|
||||
#[serde(default = "default_min_confidence")]
|
||||
|
||||
@@ -659,6 +659,13 @@ impl JobWorker {
|
||||
|
||||
info!("Processing job: {} ({})", job.uuid, job.id);
|
||||
|
||||
// Set preferred language from admin config
|
||||
if let Ok(config) = crate::core::admin_config::ADMIN_CONFIG.get_full_config().await {
|
||||
let language = config.search.vlm_output_language.clone();
|
||||
crate::core::config::set_preferred_language(language);
|
||||
tracing::info!("[WORKER] Set preferred language from admin config: {}", config.search.vlm_output_language);
|
||||
}
|
||||
|
||||
// Read face_settings from job and set environment variables for face processor
|
||||
let mut face_settings_backup: Option<(String, String)> = None;
|
||||
if let Some(ref fs) = job.face_settings {
|
||||
|
||||
Reference in New Issue
Block a user