From 67b3c673489c01306ff87f24ce9fa81ca6085d3c Mon Sep 17 00:00:00 2001 From: SudoRand Date: Sun, 1 Jun 2025 13:56:49 -0600 Subject: [PATCH 1/2] Fix bug that always enabled news_random_line_only This looks like a simple typo that accidentally used read_news_enabled for the news_random_line_only parameter. As a result, the news_random_line_only setting was always treated as True (since this line it only executed if read_news_enabled was True). Now it obeys the configuration value. --- modules/filemon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/filemon.py b/modules/filemon.py index 75372d4..6bd9abf 100644 --- a/modules/filemon.py +++ b/modules/filemon.py @@ -31,7 +31,7 @@ def read_file(file_monitor_file_path, random_line_only=False): def read_news(): # read the news file on demand - return read_file(news_file_path, read_news_enabled) + return read_file(news_file_path, news_random_line_only) def write_news(content, append=False): From 5b26aabb0037346e060b01f45ec336bd93137772 Mon Sep 17 00:00:00 2001 From: SudoRand Date: Sat, 31 May 2025 19:04:58 -0600 Subject: [PATCH 2/2] Config for whether ollama responds to non-commands The current behavior is that whenever ollama is enabled the LLM replies to all non-command message. This setting allows limiting it the LLM to run only in response to the "ask:" and "askai" commands. Default is True to keep consistent with previous behavior. --- config.template | 3 +++ mesh_bot.py | 2 +- modules/settings.py | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.template b/config.template index 92aa9cf..07af02c 100644 --- a/config.template +++ b/config.template @@ -60,6 +60,9 @@ ollama = False # ollamaModel = llama3.1 # server instance to use (defaults to local machine install) ollamaHostName = http://localhost:11434 +# Produce LLM replies to messages that aren't commands? +# If False, the LLM only replies to the "ask:" and "askai" commands. +llmReplyToNonCommands = True # StoreForward Enabled and Limits StoreForward = True diff --git a/mesh_bot.py b/mesh_bot.py index 0d142d0..55ac24d 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -1243,7 +1243,7 @@ def onReceive(packet, interface): playingGame = False if not playingGame: - if llm_enabled: + if llm_enabled and llmReplyToNonCommands: # respond with LLM llm = handle_llm(message_from_id, channel_number, rxNode, message_string, publicChannel) send_message(llm, channel_number, message_from_id, rxNode) diff --git a/modules/settings.py b/modules/settings.py index ce269d6..4e6aeaa 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -222,6 +222,7 @@ try: llm_enabled = config['general'].getboolean('ollama', False) # https://ollama.com llmModel = config['general'].get('ollamaModel', 'gemma2:2b') # default gemma2:2b ollamaHostName = config['general'].get('ollamaHostName', 'http://localhost:11434') # default localhost + llmReplyToNonCommands = config['general'].getboolean('llmReplyToNonCommands', True) # emergency response emergency_responder_enabled = config['emergencyHandler'].getboolean('enabled', False) emergency_responder_alert_channel = config['emergencyHandler'].getint('alert_channel', 2) # default 2