update
This commit is contained in:
parent
45bc433060
commit
49f2c08544
@ -213,14 +213,14 @@ async function generateResponse(conversation, message) {
|
|||||||
response += `Description: ${pageDescription}\n`;
|
response += `Description: ${pageDescription}\n`;
|
||||||
}
|
}
|
||||||
if (pageContent) {
|
if (pageContent) {
|
||||||
const MAX_CONTENT_LENGTH = 1900;
|
const MAX_CONTENT_LENGTH = process.env.MAX_CONTENT_LENGTH;
|
||||||
let plainTextContent = $('<div>').html(pageContent).text().trim().replace(/[\r\n]+/g, ' ');
|
let plainTextContent = $('<div>').html(pageContent).text().trim().replace(/[\r\n]+/g, ' ');
|
||||||
|
|
||||||
if (plainTextContent.length > MAX_CONTENT_LENGTH) {
|
if (plainTextContent.length > MAX_CONTENT_LENGTH) {
|
||||||
plainTextContent = plainTextContent.substring(0, MAX_CONTENT_LENGTH) + '...';
|
plainTextContent = plainTextContent.substring(0, MAX_CONTENT_LENGTH) + '...';
|
||||||
response += `Content: ${plainTextContent}\n`;
|
response += `Content: ${plainTextContent.trim()}`;
|
||||||
} else {
|
} else {
|
||||||
response += `Content: ${plainTextContent}\n`;
|
response += `Content: ${plainTextContent.trim()}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user