From de88fd4e443539989c7014fa3ced0429303ffa66 Mon Sep 17 00:00:00 2001 From: Accusys Date: Mon, 25 May 2026 08:50:53 +0800 Subject: [PATCH] fix: restore accidentally deleted type definitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add back PipelineType enum, ProcessorType::pipeline() method, and OLLAMA_URL/EMBED_URL/LLM_HEALTH_URL config constants — all of which were deleted in commits 78923a89 and 0856b92e while the referencing code was left intact, causing 5 compilation errors. --- src/core/config.rs | 16 ++++++++++++++++ src/core/db/postgres_db.rs | 25 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/core/config.rs b/src/core/config.rs index 140b48b..78104f4 100644 --- a/src/core/config.rs +++ b/src/core/config.rs @@ -276,6 +276,22 @@ pub mod llm { }); } +/// Ollama embedding endpoint (vector embeddings for text sync). +pub static OLLAMA_URL: Lazy = + Lazy::new(|| env::var("MOMENTRY_OLLAMA_URL").unwrap_or_else(|_| "http://127.0.0.1:11434".to_string())); + +/// Text embedding server (comic-embed or alternative). +pub static EMBED_URL: Lazy = + Lazy::new(|| env::var("MOMENTRY_EMBED_URL").unwrap_or_else(|_| "http://127.0.0.1:11436".to_string())); + +/// LLM health endpoint. +pub static LLM_HEALTH_URL: Lazy = Lazy::new(|| { + env::var("MOMENTRY_LLM_HEALTH_URL").unwrap_or_else(|_| { + let chat = llm::CHAT_URL.clone(); + chat.trim_end_matches("/v1/chat/completions").to_string() + "/health" + }) +}); + pub static SFTPGO_BASE_URL: Lazy = Lazy::new(|| { env::var("SFTPGO_BASE_URL").unwrap_or_else(|_| "http://127.0.0.1:8080".to_string()) }); diff --git a/src/core/db/postgres_db.rs b/src/core/db/postgres_db.rs index cc33da5..9eb1be0 100644 --- a/src/core/db/postgres_db.rs +++ b/src/core/db/postgres_db.rs @@ -395,6 +395,14 @@ pub struct MonitorJobStats { pub failed: i32, } +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)] +#[serde(rename_all = "snake_case")] +pub enum PipelineType { + Frame, + Time, + Cross, +} + #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)] #[serde(rename_all = "snake_case")] pub enum ProcessorType { @@ -559,6 +567,23 @@ impl ProcessorType { ProcessorType::FiveW1H, ] } + + pub fn pipeline(&self) -> PipelineType { + match self { + ProcessorType::Yolo + | ProcessorType::Ocr + | ProcessorType::Face + | ProcessorType::Pose + | ProcessorType::VisualChunk => PipelineType::Frame, + + ProcessorType::Asr + | ProcessorType::Cut + | ProcessorType::Asrx + | ProcessorType::Scene + | ProcessorType::Story + | ProcessorType::FiveW1H => PipelineType::Time, + } + } } #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]