From 7e1ff3f5f6b0f0daa592bb7e04c34dc4f2376463 Mon Sep 17 00:00:00 2001 From: Sergey Melekhin Date: Mon, 19 Feb 2024 05:50:34 +0000 Subject: [PATCH] add some extra logging --- Pipfile | 2 +- bot/skills/chat.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Pipfile b/Pipfile index c487f8a..d650964 100644 --- a/Pipfile +++ b/Pipfile @@ -5,7 +5,7 @@ name = "pypi" [[description]] name = "vldc-bot" -version = "0.8.6" +version = "0.8.7" description = "VLDC nyan bot ^_^" authors = [ #tg diff --git a/bot/skills/chat.py b/bot/skills/chat.py index 4c3dc9c..1782b49 100644 --- a/bot/skills/chat.py +++ b/bot/skills/chat.py @@ -16,8 +16,8 @@ # Max number of messages to keep in memory. MAX_MESSAGES = 100 # Max age of message to be considered for poem generation. -MAX_AGE = timedelta(hours=6) -# Number of examples to show in the prompt. +MAX_AGE = timedelta(hours=12) +# Number of examples to show to LLM in the prompt. NUM_EXAMPLES = 10 # How often muse visits Nyan. SLEEP_INTERVAL = 60 * 60 @@ -60,6 +60,7 @@ def write_a_poem(self) -> str: continue log.append(message) if len(log) < 10: + logger.info("not writing poem since only have %d messages", len(log)) return "" theme = summarize("\n".join(log)) @@ -144,6 +145,7 @@ def muse_visit(context: CallbackContext): secondsInDay = 24 * 60 * 60 inspirationRate = float(POEMS_PER_DAY) / float(secondsInDay / SLEEP_INTERVAL) if random.random() > inspirationRate: + logger.info("checked for inspiration but it did not come") return try: @@ -152,9 +154,10 @@ def muse_visit(context: CallbackContext): context.bot.send_message( chat_id=context.job.context["chat_id"], text=message ) - nyan.forget() + # Forget messages we already wrote about. + nyan.forget() except Exception as e: # pylint: disable=broad-except - logger.error("inspiration did not come: %s", e) + logger.error("inspiration failed: %s", e) def summarize(log):