Support multiple in /setpromptentry

This commit is contained in:
Cohee 2024-09-29 12:48:40 +03:00
parent d231b7f5f4
commit c3d5fba598

View File

@ -3561,11 +3561,17 @@ function setPromptEntryCallback(args, targetState) {
const prompts = promptManager.serviceSettings.prompts;
function parseArgs(arg) {
// Arg is already an array
if (Array.isArray(arg)) {
return arg;
}
const list = [];
try {
// Arg is a JSON-stringified array
const parsedArg = JSON.parse(arg);
list.push(...Array.isArray(parsedArg) ? parsedArg : [arg]);
} catch {
// Arg is a string
list.push(arg);
}
return list;