| 3592 | // Chat lore always goes first | 3592 | // Chat lore always goes first |
| 3593 | entries = [...chatLore.sort(sortFn), ...entries]; | 3593 | entries = [...chatLore.sort(sortFn), ...entries]; |
| 3594 | | 3594 | |
| 3595 | // Calculate hash and parse decorators | 3595 | // 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 | }); |
| 3601 | | 3603 | |
| 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)); |