feat: make LLM timeout configurable (default 5min)
New flag: --llm-timeout / LLM_TIMEOUT (seconds, default 300) New builder: llmClient.WithTimeout(duration) Composite action: new timeout input Keeps 5 minutes as the sensible default but allows tuning for larger repos or slower models.
This commit is contained in:
@@ -32,6 +32,7 @@ func main() {
|
||||
patternsFiles := flag.String("patterns-files", envOrDefault("PATTERNS_FILES", "README.md"), "Comma-separated file paths to fetch from patterns repo")
|
||||
dryRun := flag.Bool("dry-run", false, "Print review to stdout instead of posting")
|
||||
llmTemp := flag.Float64("llm-temperature", envOrDefaultFloat("LLM_TEMPERATURE", 0), "LLM temperature (0 = server default)")
|
||||
llmTimeout := flag.Int("llm-timeout", envOrDefaultInt("LLM_TIMEOUT", 300), "LLM request timeout in seconds (default 300)")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
@@ -65,6 +66,9 @@ func main() {
|
||||
if *llmTemp > 0 {
|
||||
llmClient.WithTemperature(*llmTemp)
|
||||
}
|
||||
if *llmTimeout > 0 {
|
||||
llmClient.WithTimeout(time.Duration(*llmTimeout) * time.Second)
|
||||
}
|
||||
|
||||
// Create a top-level context with a 3-minute timeout for all operations
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||
@@ -285,3 +289,13 @@ func envOrDefaultFloat(key string, defaultVal float64) float64 {
|
||||
}
|
||||
return defaultVal
|
||||
}
|
||||
|
||||
func envOrDefaultInt(key string, defaultVal int) int {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
i, err := strconv.Atoi(v)
|
||||
if err == nil {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return defaultVal
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user