Remove substitutions in extensions where not necessary
This commit is contained in:
parent
db9e9342fa
commit
01cdcfa198
|
@ -380,8 +380,7 @@ async function summarizeChatMain(context, force) {
|
|||
}
|
||||
|
||||
console.log('Summarizing chat, messages since last summary: ' + messagesSinceLastSummary, 'words since last summary: ' + wordsSinceLastSummary);
|
||||
const prompt = substituteParams(extension_settings.memory.prompt)
|
||||
.replace(/{{words}}/gi, extension_settings.memory.promptWords);
|
||||
const prompt = extension_settings.memory.prompt?.replace(/{{words}}/gi, extension_settings.memory.promptWords);
|
||||
|
||||
if (!prompt) {
|
||||
console.debug('Summarization prompt is empty. Skipping summarization.');
|
||||
|
|
|
@ -72,20 +72,22 @@ function getTaskByIdRecurse(taskId, task) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function substituteParamsPrompts(content) {
|
||||
function substituteParamsPrompts(content, substituteGlobal) {
|
||||
content = content.replace(/{{objective}}/gi, currentObjective.description)
|
||||
content = content.replace(/{{task}}/gi, currentTask.description)
|
||||
if (currentTask.parent){
|
||||
content = content.replace(/{{parent}}/gi, currentTask.parent.description)
|
||||
}
|
||||
content = substituteParams(content)
|
||||
if (substituteGlobal) {
|
||||
content = substituteParams(content)
|
||||
}
|
||||
return content
|
||||
}
|
||||
|
||||
// Call Quiet Generate to create task list using character context, then convert to tasks. Should not be called much.
|
||||
async function generateTasks() {
|
||||
|
||||
const prompt = substituteParamsPrompts(objectivePrompts.createTask);
|
||||
const prompt = substituteParamsPrompts(objectivePrompts.createTask, false);
|
||||
console.log(`Generating tasks for objective with prompt`)
|
||||
toastr.info('Generating tasks for objective', 'Please wait...');
|
||||
const taskResponse = await generateQuietPrompt(prompt)
|
||||
|
@ -128,7 +130,7 @@ async function checkTaskCompleted() {
|
|||
checkCounter = $('#objective-check-frequency').val()
|
||||
toastr.info("Checking for task completion.")
|
||||
|
||||
const prompt = substituteParamsPrompts(objectivePrompts.checkTaskCompleted);
|
||||
const prompt = substituteParamsPrompts(objectivePrompts.checkTaskCompleted, false);
|
||||
const taskResponse = (await generateQuietPrompt(prompt)).toLowerCase()
|
||||
|
||||
// Check response if task complete
|
||||
|
@ -178,7 +180,7 @@ function setCurrentTask(taskId = null) {
|
|||
// Don't just check for a current task, check if it has data
|
||||
const description = currentTask.description || null;
|
||||
if (description) {
|
||||
const extensionPromptText = substituteParamsPrompts(objectivePrompts.currentTask);
|
||||
const extensionPromptText = substituteParamsPrompts(objectivePrompts.currentTask, true);
|
||||
|
||||
// Remove highlights
|
||||
$('.objective-task').css({'border-color':'','border-width':''})
|
||||
|
|
Loading…
Reference in New Issue