Second macro evaluation of WI for all positions - The first macro evaluation occurs when the entry is activated. - The second macro evaluation occurs after the regex replacement * and only when the entry is before or after the char definition this may cause confusion for users. I'm not sure if this is the right thing to do, but it's one way I can think of to make all this make more sense.

8edc999854ad09c54e7dbb2ddbcae157d288954b

steve green <steve_green@qq.com>

Signed
1 files changed, +5 -3Showing whitespace changes
public/scripts/world-info.js+5 -3
@@ -4125,7 +4125,9 @@ export async function checkWorldInfo(chat, maxContext, isDryRun) {
4125 // TODO (kingbri): Change to use WI Anchor positioning instead of separate top/bottom arrays4125 // TODO (kingbri): Change to use WI Anchor positioning instead of separate top/bottom arrays
4126 [...allActivatedEntries].sort(sortFn).forEach((entry) => {4126 [...allActivatedEntries].sort(sortFn).forEach((entry) => {
4127 const regexDepth = entry.position === world_info_position.atDepth ? (entry.depth ?? DEFAULT_DEPTH) : null;4127 const regexDepth = entry.position === world_info_position.atDepth ? (entry.depth ?? DEFAULT_DEPTH) : null;
4128 const content = getRegexedString(entry.content, regex_placement.WORLD_INFO, { depth: regexDepth, isMarkdown: false, isPrompt: true });4128 const content = substituteParams(
4129 getRegexedString(entry.content, regex_placement.WORLD_INFO, { depth: regexDepth, isMarkdown: false, isPrompt: true })
4130 );
41294131
4130 if (!content) {4132 if (!content) {
4131 console.debug(`[WI] Entry ${entry.uid}`, 'skipped adding to prompt due to empty content', entry);4133 console.debug(`[WI] Entry ${entry.uid}`, 'skipped adding to prompt due to empty content', entry);
@@ -4134,10 +4136,10 @@ export async function checkWorldInfo(chat, maxContext, isDryRun) {
41344136
4135 switch (entry.position) {4137 switch (entry.position) {
4136 case world_info_position.before:4138 case world_info_position.before:
4137 WIBeforeEntries.unshift(substituteParams(content));4139 WIBeforeEntries.unshift(content);
4138 break;4140 break;
4139 case world_info_position.after:4141 case world_info_position.after:
4140 WIAfterEntries.unshift(substituteParams(content));4142 WIAfterEntries.unshift(content);
4141 break;4143 break;
4142 case world_info_position.EMTop:4144 case world_info_position.EMTop:
4143 EMEntries.unshift(4145 EMEntries.unshift(