cognovi-ai / 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 and reframing distorted thinking when you've been thinking this way your whole life. The CDJ can help with that 🧠✨ -- v2 is in development!
https://thecdj.app
4 stars 0 forks source link

Remove required from entryAnalysis analysis_content and entry title. #124

Closed hiyaryan closed 10 months ago

hiyaryan commented 10 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.