includeSpecial parameter added to getPrompts. see #183

This commit is contained in:
mic 2024-12-10 22:04:03 +01:00
parent 40448b5a2a
commit 4d7cef81f6

View file

@ -182,13 +182,15 @@ const defaultPrompts = [
]; ];
export async function getPrompts(onlyEnabled = false){ export async function getPrompts(onlyEnabled = false, includeSpecial = false){
const _defaultPrompts = await getDefaultPrompts_withProps(); const _defaultPrompts = await getDefaultPrompts_withProps();
// console.log('>>>>>>>>>>>> getPrompts _defaultPrompts: ' + JSON.stringify(_defaultPrompts)); // console.log('>>>>>>>>>>>> getPrompts _defaultPrompts: ' + JSON.stringify(_defaultPrompts));
const customPrompts = await getCustomPrompts(); const customPrompts = await getCustomPrompts();
// console.log('>>>>>>>>>>>> getPrompts customPrompts: ' + JSON.stringify(customPrompts)); // console.log('>>>>>>>>>>>> getPrompts customPrompts: ' + JSON.stringify(customPrompts));
let output = _defaultPrompts.concat(customPrompts); let output = _defaultPrompts.concat(customPrompts);
output = output.filter(obj => obj.is_special != 1); // we do not want special prompts if(!includeSpecial){
output = output.filter(obj => obj.is_special != 1); // we do not want special prompts
}
if(onlyEnabled){ if(onlyEnabled){
output = output.filter(obj => obj.enabled != 0); output = output.filter(obj => obj.enabled != 0);
}else{ // order only if we are not filtering, the filtering is for the menus and we are ordering there after i18n }else{ // order only if we are not filtering, the filtering is for the menus and we are ordering there after i18n