I like this idea. I guess this should be a radio button:
Code:
Summary (previously Meta Description):
o Text field to enter a brief summary
o Use AI to automatically generate a summary based on the text
If summary is blank, the AI option will be selected by default. If the AI option is selected, we have a decision tree:
- If the text is also blank, we will skip the API call, and leave the summary blank.
- If the text is less than 160 characters, we will just duplicate the text into the summary field.
- If the text is greater than 160 characters but less than 200 characters, we will duplicate the text into the summary field, but ellipse it to 160 characters.
- If the text is greater than 200 characters, we will ask an AI to summarize it using 160 characters or less.
Based on what I see for ChatGPT, we can use GPT-3.5 Turbo for articles between 200 and roughly 60,000 characters. However, for longer articles, rather than using more expensive models, we should process articles in pieces and make the article summary by summarizing summaries of the individual pieces. This will take longer, so it may need to be deferred. In this case, we need to make sure not to request a new AI summary on new edits until the last summary is applied. It should be applied to all more recent edits up to any new edit that has added a manual summary.
It should be noted that using AI in this way would require sending the output HTML of the article to a third-party (i.e. chatGPT) which may not be desirable for some sites. But since using this feature would require the admin to set up API keys, they could easily choose not to use it by not entering keys. If we come up with more uses for AI, it may be necessary to provide separate options for each use case.
A similar suggestion exists for a mass management tool to use AI on existing pages with empty summaries:
https://www.vaultwiki.org/issues/6408/
For mass management, I think we can use the batch API to generate summaries at a reduced price.