Fix Caching web reading the web: Append last message rather than add to the conversation.
This commit is contained in:
parent
aec98b576b
commit
cb880f9bc1
10
llamabot.js
10
llamabot.js
@ -230,11 +230,11 @@ async function generateResponse(conversation, message) {
|
|||||||
}
|
}
|
||||||
response += `URL: ${url}`;
|
response += `URL: ${url}`;
|
||||||
|
|
||||||
// Append bot message to conversation history
|
// Get the index of the last message in the array
|
||||||
conversation.messages.push({
|
const lastMessageIndex = conversation.messages.length - 1;
|
||||||
role: 'user',
|
|
||||||
content: "Data from the page is: " + response,
|
// Append a new line and the new content to the existing content of the last message
|
||||||
});
|
conversation.messages[lastMessageIndex].content += "\n" + response;
|
||||||
|
|
||||||
console.log("A URL was provided, response: " + response)
|
console.log("A URL was provided, response: " + response)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user