hiyaryan / the-cdj

The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling distorted thinking and finding alternative modes of thought (i.e. reframing) while cognitive distortions are occurring. The CDJ does that work for you. -- The CDJ is in beta testing!!
https://thecdj.app
2 stars 0 forks source link

Remove required from entryAnalysis analysis_content and entry title. #124

Closed hiyaryan closed 5 months ago

hiyaryan commented 5 months ago

This PR fixes a bug that causes the users session to stall. This occurs in two places.

  1. When the gpt does not return the response data structure as expected. While it usually always returns json, on several occasions depending on the users input, the gpt will not always return the required keys.

If "test" is used as an entry, there's nothing to analyze, so the gpt returns nothing. The issue with this is that a title was required throwing a validation error.

  1. When a first entry is posted.

The entryAnalysis validation looks for a required analysis_content field. There is none until the gpt creates one so validation throws an error.

These errors arose after updating the analysis seed. To fix these problems, required properties have been removed from title and anaysis_content and replaced with default values.