kyunghei / Timeless-Tales

A web application utilizing AI to create custom choose-your-own-adventure stories with dynamic choices/outcomes and relevant artwork.
2 stars 0 forks source link

Minor fail safe added #53

Closed ShinyMyst closed 3 months ago

ShinyMyst commented 3 months ago

When splitting choice from story, it assumes three options will be pulled from the text. If ChatGPT's response omits the correct number of "!!"s the entire thing could crash due to an indexing error. I added in a fail safe that defaults the options to nothing if this problem were to occur to avoid a crash.

Additionally, I replaced "tags.json" with a variable and defined it at the top of the page. I don't want to hardcode a file name in the middle of function and this makes it easier to change in the future.

Only four TODOs remain in the code.

  1. Changing climax to an int instead of bool (optional)
  2. Changing climax description to account for this change
  3. Fixing the routes to avoid redundancy in main
  4. Updating tag weights

None of these should have any impact on how things function and can be safely ignored unless we decide to fine tune stories.