Insert files before user text, not after

This commit is contained in:
Cohee
2023-12-01 03:54:28 +02:00
parent ebcefe67fc
commit bb727d5f9c
2 changed files with 12 additions and 8 deletions

View File

@@ -3027,8 +3027,9 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
const fileText = chatItem.extra.file.text || (await getFileAttachment(chatItem.extra.file.url));
if (fileText) {
chatItem.extra.fileStart = regexedMessage.length;
regexedMessage += `\n\n${fileText}`;
const fileWrapped = `\`\`\`\n${fileText}\n\`\`\`\n\n`;
chatItem.extra.fileLength = fileWrapped.length;
regexedMessage = fileWrapped + regexedMessage;
}
}