fix: Fixed db cursor in wrong place

This commit is contained in:
Showdown76 2024-01-17 11:45:19 +01:00
parent 11e76ff837
commit 9f711139d0

View File

@ -85,9 +85,9 @@ async def on_message(message: discord.Message):
for arg in arguments.keys(): bprompt = bprompt.replace(f'|{arg}|', arguments[arg])
c = db.cursor()
if message.author not in cached_conversations:
cached_conversations[message.author] = copeai_backend.conversation.Conversation()
c = db.cursor()
c.execute('SELECT * FROM message_history WHERE user_id = ? ORDER BY timestamp DESC', (message.author.id,))
msgs = c.fetchall()
message_token_usage = num_tokens_from_string(message.content)