mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Don't double-expand prompts if reusing
This commit is contained in:
@ -321,8 +321,14 @@ async function expandPrompt(prompt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function refinePrompt(prompt) {
|
/**
|
||||||
if (extension_settings.sd.expand) {
|
* Modifies prompt based on auto-expansion and user inputs.
|
||||||
|
* @param {string} prompt Prompt to refine
|
||||||
|
* @param {boolean} allowExpand Whether to allow auto-expansion
|
||||||
|
* @returns {Promise<string>} Refined prompt
|
||||||
|
*/
|
||||||
|
async function refinePrompt(prompt, allowExpand) {
|
||||||
|
if (allowExpand && extension_settings.sd.expand) {
|
||||||
prompt = await expandPrompt(prompt);
|
prompt = await expandPrompt(prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1159,7 +1165,7 @@ async function getPrompt(generationType, message, trigger, quiet_prompt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (generationType !== generationMode.FREE) {
|
if (generationType !== generationMode.FREE) {
|
||||||
prompt = await refinePrompt(prompt);
|
prompt = await refinePrompt(prompt, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return prompt;
|
return prompt;
|
||||||
@ -1553,7 +1559,7 @@ async function sdMessageButton(e) {
|
|||||||
try {
|
try {
|
||||||
setBusyIcon(true);
|
setBusyIcon(true);
|
||||||
if (hasSavedImage) {
|
if (hasSavedImage) {
|
||||||
const prompt = await refinePrompt(message.extra.title);
|
const prompt = await refinePrompt(message.extra.title, false);
|
||||||
message.extra.title = prompt;
|
message.extra.title = prompt;
|
||||||
|
|
||||||
console.log('Regenerating an image, using existing prompt:', prompt);
|
console.log('Regenerating an image, using existing prompt:', prompt);
|
||||||
|
Reference in New Issue
Block a user