Rename variable to not shadow the internal memory constant
This commit is contained in:
parent
c822be6880
commit
20c14e793e
2 changed files with 4 additions and 4 deletions
|
@ -38,7 +38,7 @@ Set a note by typing `note: ` when in Do mode. It will be tagged to whatever the
|
||||||
const modifier = (text) => {
|
const modifier = (text) => {
|
||||||
state.notes = state.notes || []
|
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
|
let context = info.memoryLength ? text.slice(info.memoryLength + 1) : text
|
||||||
|
|
||||||
// Assumes that the notes are sorted from oldest to newest.
|
// 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.
|
// Make sure the new context isn't too long, or it will get truncated by the server.
|
||||||
context = context.slice(-(info.maxChars - info.memoryLength))
|
context = context.slice(-(info.maxChars - info.memoryLength))
|
||||||
const finalText = [memory, context].join("\n")
|
const finalText = [contextMemory, context].join("\n")
|
||||||
return { text: finalText }
|
return { text: finalText }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
// This modifier re-implements Author's Note as an example.
|
// This modifier re-implements Author's Note as an example.
|
||||||
const modifier = (text) => {
|
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 context = info.memoryLength ? text.slice(info.memoryLength + 1) : text
|
||||||
const lines = context.split("\n")
|
const lines = context.split("\n")
|
||||||
if (lines.length > 2) {
|
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.
|
// 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 combinedLines = lines.join("\n").slice(-(info.maxChars - info.memoryLength))
|
||||||
const finalText = [memory, combinedLines].join("")
|
const finalText = [contextMemory, combinedLines].join("")
|
||||||
return { text: finalText }
|
return { text: finalText }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue