From a781f737b02777d5a49638805773627a3155f380 Mon Sep 17 00:00:00 2001 From: Fjerkroa Auto Date: Thu, 23 Mar 2023 13:10:38 +0100 Subject: [PATCH] Use `system` description, if no specific channel description is in config. --- fjerkroa_bot/ai_responder.py | 5 +++-- fjerkroa_bot/discord_bot.py | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fjerkroa_bot/ai_responder.py b/fjerkroa_bot/ai_responder.py index f24dd6c..b3f080d 100644 --- a/fjerkroa_bot/ai_responder.py +++ b/fjerkroa_bot/ai_responder.py @@ -41,8 +41,9 @@ class AIResponder(object): def _message(self, message: AIMessage, limit: Optional[int] = None) -> List[Dict[str, Any]]: messages = [] - system = self.config[self.channel].replace('{date}', time.strftime('%Y-%m-%d'))\ - .replace('{time}', time.strftime('%H:%M:%S')) + system = self.config.get(self.channel, self.config['system']) + system = system.replace('{date}', time.strftime('%Y-%m-%d'))\ + .replace('{time}', time.strftime('%H:%M:%S')) messages.append({"role": "system", "content": system}) if limit is None: history = self.history[:] diff --git a/fjerkroa_bot/discord_bot.py b/fjerkroa_bot/discord_bot.py index 751136f..c0cc1cc 100644 --- a/fjerkroa_bot/discord_bot.py +++ b/fjerkroa_bot/discord_bot.py @@ -45,7 +45,6 @@ class FjerkroaBot(commands.Bot): return toml.load(file) def on_config_file_modified(self, event): - logging.info(f"file {event.src_path} modified") if event.src_path == self.config_file: self.config = self.load_config(self.config_file) self.airesponder.config = self.config