diff options
| author | Paul Bütow <1224732+snonux@users.noreply.github.com> | 2026-02-02 20:55:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-02 20:55:36 +0200 |
| commit | da01d65da337cc2f6c99d8236140f8fb45c6bd5e (patch) | |
| tree | 4887ab977b8a92165e180dd3d3c7323df7e6172b /internal/appconfig | |
| parent | 7194696eb8c4c5bd50f69df96e9a6b87cec1f049 (diff) | |
| parent | 791cd282ec143c9bbb44eba3b2271f1573272ba5 (diff) | |
Merge pull request #2 from florianbuetow/feature-timeout-config
feat: add configurable request timeout for LLM calls
Diffstat (limited to 'internal/appconfig')
| -rw-r--r-- | internal/appconfig/config.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/appconfig/config.go b/internal/appconfig/config.go index 78237be..b17c5d4 100644 --- a/internal/appconfig/config.go +++ b/internal/appconfig/config.go @@ -27,6 +27,7 @@ type App struct { ContextWindowLines int `json:"context_window_lines" toml:"context_window_lines"` MaxContextTokens int `json:"max_context_tokens" toml:"max_context_tokens"` LogPreviewLimit int `json:"log_preview_limit" toml:"log_preview_limit"` + RequestTimeout int `json:"request_timeout" toml:"request_timeout"` // Single knob for LSP requests; if set, overrides hardcoded temps in LSP. CodingTemperature *float64 `json:"coding_temperature" toml:"coding_temperature"` // Minimum identifier characters required for manual (TriggerKind=1) invoke @@ -141,6 +142,7 @@ func newDefaultConfig() App { ContextWindowLines: 120, MaxContextTokens: 4000, LogPreviewLimit: 100, + RequestTimeout: 30, CodingTemperature: &t, OpenAITemperature: &t, OllamaTemperature: &t, @@ -256,6 +258,7 @@ type sectionGeneral struct { ContextWindowLines int `toml:"context_window_lines"` MaxContextTokens int `toml:"max_context_tokens"` CodingTemperature *float64 `toml:"coding_temperature"` + RequestTimeout int `toml:"request_timeout"` } type sectionLogging struct { @@ -419,6 +422,7 @@ func (fc *fileConfig) toApp() App { ContextWindowLines: fc.General.ContextWindowLines, MaxContextTokens: fc.General.MaxContextTokens, CodingTemperature: fc.General.CodingTemperature, + RequestTimeout: fc.General.RequestTimeout, } out.mergeBasics(&tmp) } @@ -883,6 +887,9 @@ func (a *App) mergeBasics(other *App) { if other.LogPreviewLimit >= 0 { a.LogPreviewLimit = other.LogPreviewLimit } + if other.RequestTimeout > 0 { + a.RequestTimeout = other.RequestTimeout + } if other.CodingTemperature != nil { // allow explicit 0.0 a.CodingTemperature = other.CodingTemperature } @@ -1185,6 +1192,10 @@ func loadFromEnv(logger *log.Logger) *App { out.LogPreviewLimit = n any = true } + if n, ok := parseInt("HEXAI_REQUEST_TIMEOUT"); ok { + out.RequestTimeout = n + any = true + } if n, ok := parseInt("HEXAI_MANUAL_INVOKE_MIN_PREFIX"); ok { out.ManualInvokeMinPrefix = n any = true |
