I am implementing a version history feature in my application, and the basic feature of my application is writing documents (Like google docs). So, to manage auto-saved versions, I need a small algorithm/equation, of when to save an auto-saved version.
I don't know how other applications are maintaining the auto saved version, like google docx, notion, WordPress, and others but I am thinking to manage it based on my last manually saved version, last auto saved version and difference of words between last current document.
can you please help me how can I manage my auto saved version efficiently? you can provide examples of others applications how they are managing auto saved version?
Assistant
Sure, I can help you with that. Here are some examples of how other applications manage auto-saved versions:
Google Docs: Google Docs saves a new version of the document every time a user makes a change, and also saves a version every 10 minutes even if there are no changes.
Notion: Notion saves a new version of the document every time a user makes a change, and also saves a version every 10 minutes even if there are no changes.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
WordPress: WordPress saves a new version of the document every time a user makes a change, and also saves a version every 10 minutes even if there are no changes.
To efficiently manage auto-saved versions in your application, you can use a combination of the following factors:
Time since last save: Save a new version of the document every time a user makes a change, and also save a version every 10 minutes even if there are no changes. This ensures that you have a recent version of the document in case of a system crash or user error.
Number of changes since last save: Save a new version of the document every time a user makes a significant change, such as adding or deleting a paragraph or making a major formatting change. This ensures that you have a version of the document that reflects the user's current work.
Length of document: Save a new version of the document every time a user makes a change, and also save a version every 10 minutes even if there are no changes, but only if the document is longer than a certain length, such as 1000 words. This ensures that you don't save too many versions of a short document, which can take up unnecessary storage space.
To determine the difference of words between the last current document, you can use the following algorithm:
Calculate the number of words in the current document by counting the number of words in each paragraph and summing them up.
Calculate the difference between the number of words in the current document and the number of words in the last saved version of the document.
If the difference is greater than a certain threshold, such as 100 words, save a new version of the document.
This algorithm ensures that you save a new version of the document only when the user has made significant changes, rather than saving a new version every time they make a minor change.
I hope this helps you manage auto-saved versions efficiently in your application.