feat(providers): add PICOCLAW_HTTP_TIMEOUT env var to support slow LLMs (fixes #312)
This commit is contained in:
parent
0759823248
commit
179527dcce
1 changed files with 10 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -28,8 +29,16 @@ type HTTPProvider struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHTTPProvider(apiKey, apiBase, proxy string) *HTTPProvider {
|
func NewHTTPProvider(apiKey, apiBase, proxy string) *HTTPProvider {
|
||||||
|
// Default timeout 120s, override via env
|
||||||
|
timeout := 120 * time.Second
|
||||||
|
if envTimeout := os.Getenv("PICOCLAW_HTTP_TIMEOUT"); envTimeout != "" {
|
||||||
|
if d, err := time.ParseDuration(envTimeout); err == nil {
|
||||||
|
timeout = d
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
client := &http.Client{
|
client := &http.Client{
|
||||||
Timeout: 120 * time.Second,
|
Timeout: timeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
if proxy != "" {
|
if proxy != "" {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue