fix: detect NVIDIA API as GLM provider, handle full URL path
Some checks failed
BotServer CI/CD / build (push) Has been cancelled

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-13 16:18:00 -03:00
parent 32fbdb4b17
commit 8ddcde4830
3 changed files with 8 additions and 10 deletions

View file

@ -113,6 +113,7 @@ impl DriveMonitor {
/// Load file states from disk to avoid reprocessing unchanged files
async fn load_file_states(&self) -> Result<(), Box<dyn Error + Send + Sync>> {
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

View file

@ -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

View file

@ -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