From 6a3c29d4550dd3b48680b7b1ca7b38d86d36d825 Mon Sep 17 00:00:00 2001 From: ice Date: Wed, 28 Jan 2026 11:48:59 +0800 Subject: [PATCH] fix: correctly extract host from completion_url by handling both v1 and non-v1 endpoints --- docreader/parser/caption.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docreader/parser/caption.py b/docreader/parser/caption.py index 52ae415c..cf47f780 100644 --- a/docreader/parser/caption.py +++ b/docreader/parser/caption.py @@ -238,7 +238,8 @@ class Caption: """Call Ollama API for image captioning using base64 encoded image data.""" # Extract host URL by removing the chat completions endpoint - host = self.completion_url.replace("/v1/chat/completions", "") + # Handle both "/v1/chat/completions" and "/chat/completions" patterns + host = self.completion_url.replace("/v1/chat/completions", "").replace("/chat/completions", "") # Initialize Ollama client with host and timeout client = ollama.Client(