From 8ddcde4830cf30d5638f16a6a13f9dd0a1f1ddd2 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Mon, 13 Apr 2026 16:18:00 -0300 Subject: [PATCH] fix: detect NVIDIA API as GLM provider, handle full URL path --- src/drive/drive_monitor/mod.rs | 3 ++- src/llm/glm.rs | 13 +++++-------- src/llm/mod.rs | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/drive/drive_monitor/mod.rs b/src/drive/drive_monitor/mod.rs index 3e9e42b1..ee8d349a 100644 --- a/src/drive/drive_monitor/mod.rs +++ b/src/drive/drive_monitor/mod.rs @@ -113,6 +113,7 @@ impl DriveMonitor { /// Load file states from disk to avoid reprocessing unchanged files async fn load_file_states(&self) -> Result<(), Box> { let path = self.file_state_path(); + debug!("[DRIVE_MONITOR] Loading file states from {} for bot {}", path.display(), self.bot_id); if path.exists() { match tokio_fs::read_to_string(&path).await { Ok(content) => { @@ -121,7 +122,7 @@ impl DriveMonitor { let mut file_states = self.file_states.write().await; let count = states.len(); *file_states = states; - trace!( + info!( "[DRIVE_MONITOR] Loaded {} file states from disk for bot {}", count, self.bot_id diff --git a/src/llm/glm.rs b/src/llm/glm.rs index 9166e8f1..75334b96 100644 --- a/src/llm/glm.rs +++ b/src/llm/glm.rs @@ -98,12 +98,6 @@ pub struct GLMClient { impl GLMClient { pub fn new(base_url: String) -> Self { - // For z.ai GLM API: - // - Base URL typically is: https://api.z.ai/api/coding/paas/v4 - // - Endpoint path is: /chat/completions - // - Full URL becomes: https://api.z.ai/api/coding/paas/v4/chat/completions - - // Remove trailing slash from base_url if present let base = base_url.trim_end_matches('/').to_string(); Self { @@ -113,8 +107,11 @@ impl GLMClient { } fn build_url(&self) -> String { - // GLM/z.ai uses /chat/completions (not /v1/chat/completions) - format!("{}/chat/completions", self.base_url) + if self.base_url.contains("/chat/completions") { + self.base_url.clone() + } else { + format!("{}/chat/completions", self.base_url) + } } /// Sanitizes a string by removing invalid UTF-8 surrogate characters diff --git a/src/llm/mod.rs b/src/llm/mod.rs index 85847900..fdbcf4de 100644 --- a/src/llm/mod.rs +++ b/src/llm/mod.rs @@ -595,7 +595,7 @@ impl From<&str> for LLMProviderType { } else { Self::Claude } - } else if lower.contains("z.ai") || lower.contains("glm") { + } else if lower.contains("z.ai") || lower.contains("glm") || lower.contains("nvidia") { Self::GLM } else if lower.contains("bedrock") { Self::Bedrock