Better Programming

Advice for programmers.

Follow publication

Leak of GPT Chats? Temporary History Loss? A Simple Script With GPT-4 Solves The Problem.

Nick Marnautov
Better Programming
Published in
4 min readMar 22, 2023

Some ChatGPT users have encountered issues such as disappearing dialogue history, while others have faced a different problem: seeing the dialogue topics of other users (it’s advisable not to discuss the private key of your crypto wallet with ChatGPT). To solve these issues we should interact with GPT via API and store our history locally. Let’s do this with GPT-4.

What I use ChatGPT for:

  1. Communication Advisor: I usually use ChatGPT to help me craft better responses to messages. Having many contacts, it’s sometimes challenging to quickly come up with a good reply, so here’s what I do: I input incoming messages and short draft responses into ChatGPT and ask it to improve them. Then, I often request a briefer or colloquial version, edit it myself, and send it off. When I have access to chat history it lets me continue the dialogue as ChatGPT knows the context of the discussion and therefore can generate really good improvements.
  2. Communication Summary and Recap: Since ChatGPT has access to my communication history, it can summarise conversations or remind me of crucial moments. This is especially helpful for discussions that occur infrequently. That’s why I add not only messages to Chat History but also short descriptions of voice calls and Zoom meetings.

Problem

When my Chat History disappeared I couldn’t work with it anymore. Also, I lost my records and it was really frustrating for me.

Solution

I asked Chat GPT-4 to generate a simple script that could save and resume chat history. I then requested a local interface for the script. The result? Two versions of the script — one with a web interface and one without. Now, the chat history is saved locally, and it will never be lost again.

Here’s a simple script without a web interface.

And here’s one with a web interface.

I think it’s more convenient to use a version with a web interface.
Prompts that let me get these results are described (briefly) at the end of this article.

Usage Example of Simple Script with Web Interface

The usage of ChatGPT as a communication adviser is straightforward, so I thought it would be cool to try to test it like a smart Time Planner.

So, I created a new chat (TimePlanner) and added some fake events, some of which were in very strict and formal form (date, time, place), other ones I added in a very casual way, like this one:

Horse riding lesson. Date: March 25, 2023 (repeat weekly)

And then I tried to get my new very busy schedule from GPT.

It seems to work! (ChatGPT has even noticed that horse riding should be a recurring activity.) I’ll definitely give GPT a try as a smart time planner next month. Hope it will help me with my time management!

Keep in mind, if you ask GPT something like “What are my plans for April?”, it might not give a direct answer because it’s designed not to provide personal recommendations. In such cases, I suggest manually removing the incorrect question and answer from the chat history (stored in the chat_history folder), because otherwise, it will refuse to answer your other questions.

Important Warning: GPT can make mistakes or be misleading, so be careful if you are planning something important.

If you are interested, I have actual dialogues I had with ChatGPT-4, including the one that helped me generate the scripts and another one that I used as a time planner. You can find them in this Google document.

Some Thoughts

  • Writing the program with Chat GPT-4 was faster than trying to find a solution on the internet (it literally takes less than 15 mins)
  • My previous attempt at using ChatGPT for code completion in another project was not really good. I spent a lot of time and it was much faster to write the code on my own. Maybe my experience improved because I’m now using GPT-4 instead of GPT-3.5 or maybe because that project was more complex.
  • I believe that interacting with ChatGPT via API is more secure in terms of personal data protection, as API requests are not used for training the models. Also, I think it should reduce the likelihood of data leaks.

I hope this article was helpful to you. If you are unfamiliar with Python and how to run the script, feel free to write to me and I will describe it for you.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Nick Marnautov
Nick Marnautov

Written by Nick Marnautov

Data Scientist with expertise in Computer Vision for material analysis.

Write a response