estruyf / vscode-front-matter

Front Matter is a CMS running straight in Visual Studio Code. Can be used with static site generators like Hugo, Jekyll, Hexo, NextJs, Gatsby, and many more...
https://frontmatter.codes
MIT License
2.04k stars 84 forks source link

Enhancement: Include local or remote AI to summarize a post #805

Open BillRaymond opened 6 months ago

BillRaymond commented 6 months ago

Is your feature request related to a problem? Please describe. I use Front Matter to post my podcasts. Each podcast post contains a transcript. Each transcript requires a summary.

I want to put a summary at the top of the page to share the podcast with my listeners. To do that, I have to leave FM, go to Ollama locally, OpenAI, or Claude, and then copy/paste the summary into Front Matter.

Describe the solution you'd like Provide a facility within Front Matter to (a) use a local model with Ollama or (b) a web-based API solution using a product like OpenAI's ChatGPT. I would imagine a flow like this:

  1. Create a new post with whatever content you have (in my case, the transcript for a podcast)
  2. With the post open, use the Front Matter sidebar to enter a prompt, like summarize this using the following format...
  3. Front Matter provides the AI's response, and there is an interface to insert the text wherever the cursor is currently blinking in the text window

Describe alternatives you've considered Right now, I am doing a dance where I have to go to one AI system, upload the transcript, wait for the AI to read and understand the transcript, and then provide a summarization prompt. Once I receive the prompt, I copy that text and paste it into Front Matter.

Additional context While this might sound like an easy exercise, I must leave and return to Front Matter a lot. If I am uploading a podcast, I have to go to my podcast provider, get the link to the show, and then return to FM to paste it. I then have to go through the same process of getting the YouTube link, the guest's LinkedIn profile, book links, etc. The less I have to go back and forth with FM, the better.

Here is a link to a podcast episode.

Here is a sample prompt I might create:

Pretend you are the guest of the podcast and use this template:

A quick, catchy title focused on the topic and in the form of a question to get a potential listener interested. Start the title with an emoji.

A short 2-3 sentence paragraph that describes why the guest(s) are excited to be on the podcast.

A 2-3 sentence paragraph explains what the podcast host and guest discuss.

In this podcast, you will learn the following:
✅ An important topic
✅ Another important topic
✅ Another important topic
🎉 The most important topic

Relevant hashtags
estruyf commented 6 months ago

Hi @BillRaymond have you tried out the custom actions/scripts functionality for this? https://frontmatter.codes/docs/custom-actions

You can use it to run a script for the current file and update your page's front matter. Here you can find an example: https://frontmatter.codes/docs/custom-actions#updating-the-front-matter-of-your-content