Rename variable to not shadow the internal memory constant

This commit is contained in:
Andrew Cantino 2020-09-30 17:17:11 -07:00
parent c822be6880
commit 20c14e793e
2 changed files with 4 additions and 4 deletions

View file

@ -38,7 +38,7 @@ Set a note by typing `note: ` when in Do mode. It will be tagged to whatever the
const modifier = (text) => {
state.notes = state.notes || []
const memory = text.slice(0, info.memoryLength || 0)
const contextMemory = text.slice(0, info.memoryLength || 0)
let context = info.memoryLength ? text.slice(info.memoryLength + 1) : text
// Assumes that the notes are sorted from oldest to newest.
@ -61,7 +61,7 @@ const modifier = (text) => {
// Make sure the new context isn't too long, or it will get truncated by the server.
context = context.slice(-(info.maxChars - info.memoryLength))
const finalText = [memory, context].join("\n")
const finalText = [contextMemory, context].join("\n")
return { text: finalText }
}

View file

@ -6,7 +6,7 @@
// This modifier re-implements Author's Note as an example.
const modifier = (text) => {
const memory = info.memoryLength ? text.slice(0, info.memoryLength) : ''
const contextMemory = info.memoryLength ? text.slice(0, info.memoryLength) : ''
const context = info.memoryLength ? text.slice(info.memoryLength + 1) : text
const lines = context.split("\n")
if (lines.length > 2) {
@ -15,7 +15,7 @@ const modifier = (text) => {
}
// Make sure the new context isn't too long, or it will get truncated by the server.
const combinedLines = lines.join("\n").slice(-(info.maxChars - info.memoryLength))
const finalText = [memory, combinedLines].join("")
const finalText = [contextMemory, combinedLines].join("")
return { text: finalText }
}