getSpecialPrompts pupolates additional special prompts in the saved object
This commit is contained in:
parent
e785b5d0aa
commit
6d4c5fad52
1 changed files with 15 additions and 1 deletions
|
|
@ -324,7 +324,21 @@ export async function getSpecialPrompts(){
|
||||||
})
|
})
|
||||||
return def_specPrompts;
|
return def_specPrompts;
|
||||||
} else {
|
} else {
|
||||||
return prefs._special_prompts;
|
let updatedPrompts = [...prefs._special_prompts];
|
||||||
|
|
||||||
|
specialPrompts.forEach((defaultPrompt) => {
|
||||||
|
if (!updatedPrompts.some((prompt) => prompt.id === defaultPrompt.id)) {
|
||||||
|
let newPrompt = { ...defaultPrompt };
|
||||||
|
newPrompt.text = browser.i18n.getMessage(newPrompt.text);
|
||||||
|
updatedPrompts.push(newPrompt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (updatedPrompts.length !== prefs._special_prompts.length) {
|
||||||
|
await browser.storage.local.set({ _special_prompts: updatedPrompts });
|
||||||
|
}
|
||||||
|
|
||||||
|
return updatedPrompts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue