Try to preserve old hashes

34b2707895daa74d256ba95081d308a7f6098369

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +5 -3Ignore whitespace
public/scripts/world-info.js+5 -3
@@ -3592,11 +3592,13 @@ export async function getSortedEntries() {
3592 // Chat lore always goes first3592 // Chat lore always goes first
3593 entries = [...chatLore.sort(sortFn), ...entries];3593 entries = [...chatLore.sort(sortFn), ...entries];
35943594
3595 // Calculate hash and parse decorators3595 // Calculate hash and parse decorators. Split maps to preserve old hashes.
3596 entries = entries.map((entry) => {3596 entries = entries.map((entry) => {
3597 const hash = getStringHash(JSON.stringify(entry));
3598 const [decorators, content] = parseDecorators(entry.content || '');3597 const [decorators, content] = parseDecorators(entry.content || '');
3599 return { ...entry, decorators, content, hash };3598 return { ...entry, decorators, content };
3599 }).map((entry) => {
3600 const hash = getStringHash(JSON.stringify(entry));
3601 return { ...entry, hash };
3600 });3602 });
36013603
3602 console.debug(`[WI] Found ${entries.length} world lore entries. Sorted by strategy`, Object.entries(world_info_insertion_strategy).find((x) => x[1] === world_info_character_strategy));3604 console.debug(`[WI] Found ${entries.length} world lore entries. Sorted by strategy`, Object.entries(world_info_insertion_strategy).find((x) => x[1] === world_info_character_strategy));