From 2b2b386f5e0fb7a918b2a54a99e6bf9a9e624189 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Thu, 9 Apr 2026 22:51:32 -0300 Subject: [PATCH] Fix duplicate endpoint path in LLM URL --- src/llm/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/llm/mod.rs b/src/llm/mod.rs index 5c3a5b03..b8811ea3 100644 --- a/src/llm/mod.rs +++ b/src/llm/mod.rs @@ -170,7 +170,12 @@ impl OpenAIClient { let has_chat_path = !has_v1_path && trimmed_base.contains("/chat/completions"); let endpoint = if let Some(path) = endpoint_path { - path + // If endpoint path is already in base URL, use empty to avoid duplication + if trimmed_base.contains(&path) { + "".to_string() + } else { + path + } } else if has_v1_path || (has_chat_path && !trimmed_base.contains("z.ai")) { // Path already in base_url, use empty endpoint "".to_string()