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:
@ -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':''})
|
||||
|
Reference in New Issue
Block a user