Merge branch 'staging' into char-find-and-sendas-extended

This commit is contained in:
Cohee 2024-09-29 13:37:09 +03:00
commit 57bbd349a0
1 changed files with 6 additions and 0 deletions

View File

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