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