ocdevel / gnothi

Gnothi is an open-source AI journal and toolkit for self-discovery. If you're interested in getting involved, we'd love to hear from you.
https://gnothiai.com
GNU Affero General Public License v3.0
166 stars 18 forks source link

Save prompt history #164

Open lefnire opened 1 year ago

lefnire commented 1 year ago

When you chat with Prompt (GPT or #160), the conversation should be persisted to DB so you can revisit. This is especially true of Entry mode (open a single entry modal), it would be easy to save the conversation to the entry. As for List mode (viewing multiple entries, with filters applied) we should save the convo history to DB and there should be a tab in the Prompt modal for viewing prior conversations. The current approach is 0 saving, not even LocalStorage. If you close Prompt and come back, it's a brand new chat. So until we get DB persistence, we should at least have LocalStorage to hold us over.

I think the best way to approach this via the DB schema is Notes. In the past, Notes was intended for things like labeling your entries, though diffusion, CBT, etc. There were 3 types: comment, resource, and label. Going forward into the Groups feature, this whole system will be moved instead to Chat. There aren't note-types, instead there's just a chat field you can just type whatever, under your entry. Same personal benefit, just simpler. Then, if you share the entry with a friend or therapist or Group, they can see that chat and chime in as well - hence "chat". I think I'll still call it "Notes", since that's a more general term and fits with the mental model like Instagram. With this structure, we could remove the Prompt box and instead add a checkbox next to the Notes textfield like "let AI respond", and it chimes into chat like it's someone you shared with; just with a visual indicator that it's the AI.