mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Actually support comma-split syntax in random
This commit is contained in:
@ -190,7 +190,10 @@ function randomReplace(input, emptyListPlaceholder = '') {
|
||||
|
||||
input = input.replace(randomPatternNew, (match, listString) => {
|
||||
//split on double colons instead of commas to allow for commas inside random items
|
||||
const list = listString.split('::').filter(item => item.length > 0);
|
||||
const list = listString.includes('::')
|
||||
? listString.split('::').filter(item => item.length > 0)
|
||||
: listString.split(',').map(item => item.trim()).filter(item => item.length > 0);
|
||||
|
||||
if (list.length === 0) {
|
||||
return emptyListPlaceholder;
|
||||
}
|
||||
|
Reference in New Issue
Block a user