From 03f222a1a3e1a9fbe97f0b5a3b1334b9bf6552ce Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Wed, 5 Jun 2024 03:07:51 +0100 Subject: [PATCH] Re-fix adding trump things --- src/cogs/ollama.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/cogs/ollama.py b/src/cogs/ollama.py index 4122ecb..c9c251e 100644 --- a/src/cogs/ollama.py +++ b/src/cogs/ollama.py @@ -1041,8 +1041,15 @@ class Ollama(commands.Cog): truths: list[TruthPayload] = list(map(lambda t: TruthPayload.model_validate(t), truths)) for truth in truths: if truth.author == "trump": - self.history.add_message(thread_id, "assistant", truth.content, save=False) - break + await asyncio.to_thread( + functools.partial( + self.history.add_message, + thread_id, + "assistant", + truth.content, + save=False + ) + ) self.history.add_message(thread_id, "user", "Generate a new truth post.") tried = set() @@ -1078,7 +1085,7 @@ class Ollama(commands.Cog): last_edit = time.time() for truth in truths: - if truth["content"] == embed.description: + if truth.content == embed.description: embed.add_field( name="Repeated truth :(", value="This truth was already truthed. Shit AI."