From 1a11d281ec75bb6841cf51ed5d950cd4fa0add42 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Tue, 11 Apr 2023 17:38:47 +0200 Subject: [PATCH] fixing duplicate message bug --- llamabot.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/llamabot.js b/llamabot.js index 95d6d04..153ef3f 100644 --- a/llamabot.js +++ b/llamabot.js @@ -121,13 +121,6 @@ client.on('messageCreate', async (message) => { role: 'assistant', content: `Hello, ${message.author.username}, I am here to answer any question you have, how may I help you?` }); - - } else { - // Append user message to conversation history - conversation.messages.push({ - role: 'user', - content: message.cleanContent - }); } if (message.content === '!reset' || message.content === '!r') { @@ -185,6 +178,8 @@ async function generateResponse(conversation) { const messagesCopy = [...conversation.messages]; // create a copy of the messages array + console.log(conversation) + try { const response = await fetch(`http://${process.env.ROOT_IP}:${process.env.ROOT_PORT}/v1/chat/completions`, { method: 'POST',