mode agent : toggle web pour désactiver la limite d'appels d'outils (config TOOL_LIMIT)

La limite iter<8 (message [stop: trop d'appels d'outils]) est désormais
pilotée par TOOL_LIMIT dans config.env, exposée par un interrupteur sous
Mode agent. Activée par défaut ; désactivée => plafond quasi illimité
(l'anti-boucle sur appels répétés reste actif). Lu à chaque tour, pas de
restart nécessaire. Tunnelé tel quel via /api/e2e/req pour ajean.link.
This commit is contained in:
nathaninline committed 2026-07-06 11:38:02 +02:00
1 parent cc24074f69
commit 5ef02672d2
4 files changed
+55 -2

No files matched your search

+21
View File
@@ -139,6 +139,27 @@ func SetConfigKey(key, value string) error {
return os.WriteFile(confPath(), []byte(content), 0o644)
}
// toolLimitEnabled reports whether the per-turn tool-call cap is active.
// Default: true (limité). Only an explicit "off"/"false"/"0"/"no" in config.env
// (TOOL_LIMIT) disables it — anything else keeps the safety cap on.
func toolLimitEnabled() bool {
switch strings.ToLower(strings.TrimSpace(ReadConfig()["TOOL_LIMIT"])) {
case "off", "false", "0", "no", "non":
return false
}
return true
}
// toolCallLimit returns the max number of agentic tool-call iterations per turn.
// 8 when the limit is on (default), a very high ceiling when the user disabled it
// from the web UI — the repeated-call anti-loop still guards against runaways.
func toolCallLimit() int {
if toolLimitEnabled() {
return 8
}
return 1000
}
// LLMPort returns the configured server port (config.env PORT), default 8080.
func LLMPort() int {
if p, ok := ReadConfig()["PORT"]; ok {