mirror of
				https://github.com/SillyTavern/SillyTavern.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	Remove forced newline separator from group join wrappers (#3722)
* Remove forced newline separator from group join wrappers * Remove unnecessary ternary * Do not trim field wrappers
This commit is contained in:
		@@ -435,16 +435,18 @@ export function getGroupCharacterCards(groupId, characterId) {
 | 
			
		||||
     * @param {string} value Value to replace
 | 
			
		||||
     * @param {string} fieldName Name of the field
 | 
			
		||||
     * @param {string} characterName Name of the character
 | 
			
		||||
     * @param {boolean} trim Whether to trim the value
 | 
			
		||||
     * @returns {string} Replaced text
 | 
			
		||||
     * */
 | 
			
		||||
    function customBaseChatReplace(value, fieldName, characterName) {
 | 
			
		||||
    function customBaseChatReplace(value, fieldName, characterName, trim) {
 | 
			
		||||
        if (!value) {
 | 
			
		||||
            return '';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // We should do the custom field name replacement first, and then run it through the normal macro engine with provided names
 | 
			
		||||
        value = value.replace(/<FIELDNAME>/gi, fieldName);
 | 
			
		||||
        return baseChatReplace(value.trim(), name1, characterName);
 | 
			
		||||
        value = trim ? value.trim() : value;
 | 
			
		||||
        return baseChatReplace(value, name1, characterName);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -467,13 +469,12 @@ export function getGroupCharacterCards(groupId, characterId) {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Prepare and replace prefixes
 | 
			
		||||
        const prefix = customBaseChatReplace(group.generation_mode_join_prefix, fieldName, characterName);
 | 
			
		||||
        const suffix = customBaseChatReplace(group.generation_mode_join_suffix, fieldName, characterName);
 | 
			
		||||
        const separator = power_user.instruct.wrap ? '\n' : '';
 | 
			
		||||
        const prefix = customBaseChatReplace(group.generation_mode_join_prefix, fieldName, characterName, false);
 | 
			
		||||
        const suffix = customBaseChatReplace(group.generation_mode_join_suffix, fieldName, characterName, false);
 | 
			
		||||
        // Also run the macro replacement on the actual content
 | 
			
		||||
        value = customBaseChatReplace(value, fieldName, characterName);
 | 
			
		||||
        value = customBaseChatReplace(value, fieldName, characterName, true);
 | 
			
		||||
 | 
			
		||||
        return `${prefix ? prefix + separator : ''}${value}${suffix ? separator + suffix : ''}`;
 | 
			
		||||
        return `${prefix}${value}${suffix}`;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const scenarioOverride = chat_metadata['scenario'];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user