From 5dbd5bfd6ff4adfad9028d1564a899dd6f433d2a Mon Sep 17 00:00:00 2001 From: Justin Bollinger Date: Mon, 16 Mar 2026 11:33:05 -0400 Subject: [PATCH] fix: use .get() with defaults for ollama/omen/update config keys Config keys added after initial release (ollamaModel, ollamaNumCtx, omenTrainingList, omenMaxCandidates, check_for_updates) raised KeyError when config.json.example was not found for auto-injection. --- hate_crack/main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hate_crack/main.py b/hate_crack/main.py index 7ad5a8c..a8aa4ba 100755 --- a/hate_crack/main.py +++ b/hate_crack/main.py @@ -352,12 +352,12 @@ hcatGoodMeasureBaseList = config_parser["hcatGoodMeasureBaseList"] hcatDebugLogPath = os.path.expanduser(config_parser["hcatDebugLogPath"]) ollamaUrl = "http://" + os.environ.get("OLLAMA_HOST", "localhost:11434") -ollamaModel = config_parser["ollamaModel"] -ollamaNumCtx = int(config_parser["ollamaNumCtx"]) +ollamaModel = config_parser.get("ollamaModel", "mistral") +ollamaNumCtx = int(config_parser.get("ollamaNumCtx", 2048)) -omenTrainingList = config_parser["omenTrainingList"] -omenMaxCandidates = int(config_parser["omenMaxCandidates"]) -check_for_updates_enabled = config_parser["check_for_updates"] +omenTrainingList = config_parser.get("omenTrainingList", "rockyou.txt") +omenMaxCandidates = int(config_parser.get("omenMaxCandidates", 1000000)) +check_for_updates_enabled = config_parser.get("check_for_updates", True) hcatExpanderBin = "expander.bin" hcatCombinatorBin = "combinator.bin"