refactor: centralize port config + fix 8082 conflict
- Add EMBED_URL, OLLAMA_URL, LLM_HEALTH_URL to config.rs - Fix health.rs hardcoded ports → config references - Fix sync_db.rs Ollama URL → config::OLLAMA_URL - Create config/port_registry.tsv (single source of truth for ports) - Remove Caddy 8082 proxy block (port belongs to LLM) - Fix .env LLM_URL: localhost → 127.0.0.1 (avoid IPv6 Caddy conflict)
This commit is contained in:
@@ -132,6 +132,19 @@ pub static SYSTEM_TIMEZONE: Lazy<String> = Lazy::new(|| {
|
||||
pub static MONGODB_DATABASE: Lazy<String> =
|
||||
Lazy::new(|| env::var("MONGODB_DATABASE").unwrap_or_else(|_| "momentry".to_string()));
|
||||
|
||||
pub static EMBED_URL: Lazy<String> =
|
||||
Lazy::new(|| env::var("MOMENTRY_EMBED_URL").unwrap_or_else(|_| "http://localhost:11436".to_string()));
|
||||
|
||||
pub static OLLAMA_URL: Lazy<String> =
|
||||
Lazy::new(|| env::var("MOMENTRY_OLLAMA_URL").unwrap_or_else(|_| "http://localhost:11434".to_string()));
|
||||
|
||||
/// LLM health endpoint derived from CHAT_URL.
|
||||
/// e.g. "http://127.0.0.1:8082/v1/chat/completions" → "http://127.0.0.1:8082/health"
|
||||
pub static LLM_HEALTH_URL: Lazy<String> = Lazy::new(|| {
|
||||
let chat = llm::CHAT_URL.clone();
|
||||
chat.trim_end_matches("/v1/chat/completions").to_string() + "/health"
|
||||
});
|
||||
|
||||
pub static QDRANT_COLLECTION: Lazy<String> =
|
||||
Lazy::new(|| env::var("QDRANT_COLLECTION").unwrap_or_else(|_| "momentry_rule1".to_string()));
|
||||
|
||||
@@ -234,15 +247,11 @@ pub mod llm {
|
||||
|
||||
/// Vision LLM endpoint (frame analysis, OCR). Can be same as CHAT_URL or different.
|
||||
/// Default: falls back to CHAT_URL
|
||||
pub static VISION_URL: Lazy<String> = Lazy::new(|| {
|
||||
env::var("MOMENTRY_LLM_VISION_URL")
|
||||
.unwrap_or_else(|_| CHAT_URL.clone())
|
||||
});
|
||||
pub static VISION_URL: Lazy<String> =
|
||||
Lazy::new(|| env::var("MOMENTRY_LLM_VISION_URL").unwrap_or_else(|_| CHAT_URL.clone()));
|
||||
|
||||
pub static VISION_MODEL: Lazy<String> = Lazy::new(|| {
|
||||
env::var("MOMENTRY_LLM_VISION_MODEL")
|
||||
.unwrap_or_else(|_| CHAT_MODEL.clone())
|
||||
});
|
||||
pub static VISION_MODEL: Lazy<String> =
|
||||
Lazy::new(|| env::var("MOMENTRY_LLM_VISION_MODEL").unwrap_or_else(|_| CHAT_MODEL.clone()));
|
||||
|
||||
/// Text summary LLM endpoint (5W1H, story). Can be same as CHAT_URL or different.
|
||||
pub static SUMMARY_URL: Lazy<String> = Lazy::new(|| {
|
||||
|
||||
Reference in New Issue
Block a user