diff options
Diffstat (limited to 'internal/llm/ollama.go')
| -rw-r--r-- | internal/llm/ollama.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/llm/ollama.go b/internal/llm/ollama.go index f355166..a22dd7b 100644 --- a/internal/llm/ollama.go +++ b/internal/llm/ollama.go @@ -42,14 +42,21 @@ type ollamaChatResponse struct { // Constructor (kept among the first functions by convention) func newOllama(baseURL, model string, defaultTemp *float64) Client { + return newOllamaWithTimeout(baseURL, model, defaultTemp, 0) +} + +func newOllamaWithTimeout(baseURL, model string, defaultTemp *float64, timeoutSec int) Client { if strings.TrimSpace(baseURL) == "" { baseURL = "http://localhost:11434" } if strings.TrimSpace(model) == "" { model = "qwen3-coder:30b-a3b-q4_K_M" } + if timeoutSec <= 0 { + timeoutSec = 30 + } return ollamaClient{ - httpClient: &http.Client{Timeout: 30 * time.Second}, + httpClient: &http.Client{Timeout: time.Duration(timeoutSec) * time.Second}, baseURL: strings.TrimRight(baseURL, "/"), defaultModel: model, chatLogger: logging.NewChatLogger("ollama"), |
