Display existing prompts in instruct migration dialog

This commit is contained in:
Cohee 2024-09-22 22:46:31 +03:00
parent ece2684001
commit 9d38878007
2 changed files with 11 additions and 3 deletions

View File

@ -73,7 +73,8 @@ export async function checkForSystemPromptInInstructTemplate(name, template) {
return;
}
if ('system_prompt' in template && template.system_prompt) {
const html = await renderTemplateAsync('migrateInstructPrompt', { prompt: template.system_prompt });
const existingName = system_prompts.find(x => x.content === template.system_prompt)?.name;
const html = await renderTemplateAsync('migrateInstructPrompt', { prompt: template.system_prompt, existing: existingName });
const confirm = await callGenericPopup(html, POPUP_TYPE.CONFIRM);
if (confirm) {
const migratedName = `[Migrated] ${name}`;

View File

@ -1,10 +1,17 @@
<h3>
This instruct template also contains a system prompt.
</h3>
<div class="marginBot10">
<div>
Would you like to migrate the system prompt from the template?
</div>
<div class="justifyLeft marginBot10">
{{#if existing}}
<div class="marginTopBot5">
<b>Note:</b>
<span>you already have this prompt saved as:</span>
<span>{{existing}}</span>
</div>
{{/if}}
<div class="justifyLeft marginTop5">
<div>
<small>
<b>"Yes"</b> &ndash; The prompt will be imported and selected as a current system prompt.