Entries were being added to the prompt in an inconsistent way. WI
before and after character were using newline formatting while AN
was using array joins. This caused some issues with insertion order
in the prompt.
Fix this by making each injection use an array and unshift elements
into them. Then, join them into a string that preserves insertion
order.
The reason why unshift is used is because higher insertion orders
translate to a higher priority during scanning. This prevents the
need to reverse arrays which is a more costly function depending
on how many entries are in them.
Signed-off-by: kingbri <bdashore3@proton.me>
Some characters have different cards depending on what the user wants
from the character. However, maintaining multiple lorebooks for different
personas of the same character can be difficult. In addition, there
is redundancy, overlap, and possiblities to miss information when
creating separate lorebooks with the same base info.
Therefore, add a "DLC"/layering system of sorts for characters.
This works the same way as multi-global world info where character
lorebooks added as needed. The only catch is that a base character
book must be tied to a card before selecting any extra info.
Signed-off-by: kingbri <bdashore3@proton.me>
Use a switch instead of if/else chain, fix un-needed addition
when determining token counts, and remove newline spacing for AN
WI formatting.
Signed-off-by: kingbri <bdashore3@proton.me>
Global world info always involved some kind of merging leading to
extremely large lorebook files that took a long time to import.
This commit adds the ability to select more than one world info file
and they will be merged together along with character world info.
In short, multiple worlds can be meshed together to further contribute
to context.
You can also use this for world "DLCs" of sorts. Let's say someone
else has more information to add regarding a world, but doesn't
want to use a large world file. The JSONs can now be merged.
Signed-off-by: kingbri <bdashore3@proton.me>