Fix generate_truth not limiting correctly
All checks were successful
Build and Publish college-bot-v2 / build_and_publish (push) Successful in 13s

This commit is contained in:
Nexus 2024-06-06 01:09:38 +01:00
parent e4d3d0fe56
commit 69bd4fca90
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -1044,7 +1044,8 @@ class Ollama(commands.Cog):
"\n\nAfter reading through all" "\n\nAfter reading through all"
" of your previous truth posts, you should generate another one, ready to be posted, " " of your previous truth posts, you should generate another one, ready to be posted, "
"under 4000 characters. Write only the content to be posted, do not include any pleasantries." "under 4000 characters. Write only the content to be posted, do not include any pleasantries."
" Write using the style of a twitter or facebook post. Do not repeat a previous post." " Write using the style of a twitter or facebook post. Do not repeat a previous post or any previous "
"content."
) )
thread_id = self.history.create_thread( thread_id = self.history.create_thread(
ctx.author, ctx.author,
@ -1067,6 +1068,7 @@ class Ollama(commands.Cog):
truths = list(filter(lambda t: t.author == entity, truths)) truths = list(filter(lambda t: t.author == entity, truths))
if limit: if limit:
truths.sort(key=lambda t: t.timestamp, reverse=True) # newest first truths.sort(key=lambda t: t.timestamp, reverse=True) # newest first
truths = truths[:limit]
for truth in truths: for truth in truths:
await asyncio.to_thread( await asyncio.to_thread(