diff --git a/llamabot.js b/llamabot.js
index 97d7f84..3d95bfe 100644
--- a/llamabot.js
+++ b/llamabot.js
@@ -213,14 +213,14 @@ async function generateResponse(conversation, message) {
response += `Description: ${pageDescription}\n`;
}
if (pageContent) {
- const MAX_CONTENT_LENGTH = 1900;
+ const MAX_CONTENT_LENGTH = process.env.MAX_CONTENT_LENGTH;
let plainTextContent = $('
').html(pageContent).text().trim().replace(/[\r\n]+/g, ' ');
if (plainTextContent.length > MAX_CONTENT_LENGTH) {
plainTextContent = plainTextContent.substring(0, MAX_CONTENT_LENGTH) + '...';
- response += `Content: ${plainTextContent}\n`;
+ response += `Content: ${plainTextContent.trim()}`;
} else {
- response += `Content: ${plainTextContent}\n`;
+ response += `Content: ${plainTextContent.trim()}`;
}
}
@@ -236,7 +236,7 @@ async function generateResponse(conversation, message) {
} catch (err) {
console.error(err);
- return sendRand(errorMessages);
+ return sendRand(errorMessages);
}
}
}