henk717 / KoboldAI

KoboldAI is generative AI software optimized for fictional use, but capable of much more!
http://koboldai.com
GNU Affero General Public License v3.0
352 stars 130 forks source link

fix(load_json): use int action id #483

Closed nkpz closed 6 months ago

nkpz commented 8 months ago

When a story is loaded from JSON, it currently does not convert the action IDs to ints. It looks like Kobold prevents this from causing issues by refreshing the page, but in Ghostpad I've noticed catastrophic bugs resulting from it.

First a story is loaded and string-based IDs get loaded in state

Screenshot 2023-11-10 at 04 49 45

Then as the story is edited, it (correctly) stores those changes using int based IDs

Screenshot 2023-11-10 at 04 48 25

And that's where things get very broken.

This PR makes two small changes to load_json:

  1. Store the int based action id in a variable called action_id so we don't have to cast it 4+ times
  2. Use the int based action id in the data that gets sent to process_variable_changes

I could work around this on the frontend, but I think it makes more sense to have consistent types being sent over the socket