fixing duplicate message bug
This commit is contained in:
parent
7d68f426d0
commit
1a11d281ec
@ -121,13 +121,6 @@ client.on('messageCreate', async (message) => {
|
|||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
content: `Hello, ${message.author.username}, I am here to answer any question you have, how may I help you?`
|
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') {
|
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
|
const messagesCopy = [...conversation.messages]; // create a copy of the messages array
|
||||||
|
|
||||||
|
console.log(conversation)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`http://${process.env.ROOT_IP}:${process.env.ROOT_PORT}/v1/chat/completions`, {
|
const response = await fetch(`http://${process.env.ROOT_IP}:${process.env.ROOT_PORT}/v1/chat/completions`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
Loading…
Reference in New Issue
Block a user