ChatGPT action: Add new options to make more generic and much more powerful and flexible

I was just playing with the "Transform & Replace Selection with ChatGPT" and it's really cool.

It occurred to me it could be made much more powerful with just a few simple tweaks:

  1. Rename the action to "Get response from ChatGPT"
  2. Add an option to choose between "use selection" (as now) or "use clipboard contents" or "provide input text"
  3. Add an option to choose between "immediately paste response" (as it always does now) or:
    a. Add to clipboard for later pasting;
    b. Display output and prompt again in a window that mimics the ChatGPT interface (Prompt followed by answer followed by prompt, etc), thus providing a BTT-managed version of the ChatGPT website;

Explanations and example use cases:

Idea 2 : user can create actions that operate on already copied text ("use clipboard contents"), or which always asks for the text to use. These provide extra flexibility, especially when combined with the options described below.

Idea 3.a : the user can get a response without needing to be in an editable text window. For example, with configured prompt "Summarise the provided text into one paragraph", user can select all text on a website, run the action, and now has in their clipboard a summary that they can then paste into one or many places. They don't need to paste the whole article first and summarise it in-situ.

This will be especially valuable in situations where the user plans to use the output in length-limited or content-restricted environments. For example, if I am filling in data into a web form, the form field may not allow me to paste a whole article into it in order to then have ChatGPT replace that with a summary. In that scenario I'd have to first paste the article into a text editor, replace it there, and then copy and paste that into the desired output field. If BTT could summarise to clipboard, those extra steps would not be needed.

Also, having the text added to the clipboard should allow (I think?) chaining of BTT actions. I believe it would then be possible to have a subsequent BTT action that transformed that clipboard contents, and did further things with it. For example, the user could make a prompt that asks for HTML and CSS, output to clipboard, then have an action that pastes the clipboard into a file, followed by an action that opens that file in a web browser so the user can immediately see the web page that ChatGPT produced.

Idea 3.b provides a BTT-controlled ChatGPT interface that the user can access any time, anywhere - saving the need of opening the ChatGPT UI and logging in. Admins could use this feature to provide an already-configured, context-limited ChatGPT (via the configured System and User prompt fields) to staff, end users, etc. This could be rolled out to all Mac systems in an organisation, providing a standardised way to talk to ChatGPT appropriate to that organisation or group.

For example, a school music lab might have a ChatGPT action configured with "You are a music teacher. You will limit all your discussions to music, music theory and the history of music. You will reject any questions not about music. Write your answers in a manner suitable for 15 year olds."

Example of how that might look, demonstrated using normal ChatGPT - imagine this provided by a BTT trigger shortcut that brings up an answer/response window limited to certain questions

The possibilities will be endless! :smiley:

Yep I have planned better ChatGPT actions :slight_smile:

For now you could replicate most of it if you know some HTML / JS and use the floating webview. Here is an example. It get's the clipboard content and then calls the following to make it upper case, then it displays the result in the webview.
let res = await chatGPTRequest(clipboardContent, "make everything that follows uppercase");

<html>
  <style>
     body {
      background: white;
    }
    .lds-dual-ring {
      display: inline-block;
      width: 80px;
      height: 80px;
    }
    .lds-dual-ring:after {
      content: " ";
      display: block;
      width: 64px;
      height: 64px;
      margin: 8px;
      border-radius: 50%;
      border: 6px solid #fff;
      border-color: #5e5b9f transparent #504691 transparent;
      animation: lds-dual-ring 1.2s linear infinite;
    }
    @keyframes lds-dual-ring {
      0% {
        transform: rotate(0deg);
      }
      100% {
        transform: rotate(360deg);
      }
    }
  </style>
  <script>
    async function chatGPTRequest(input, request) {
      return await callBTT("callChatGPT", {
        identifier: "test",
        system: "you are a helpful assistant",
        user: request,
        input: input,
        maxHistory: 0,
      });
    }
    async function BTTInitialize() {
      let selectedText = await callBTT("get_clipboard_content");
      let res = await chatGPTRequest(selectedText, "make everything that follows uppercase");
      document.getElementById("result").innerHTML = res;
      document.getElementById("loader").style.display = "none";
    }
  </script>
  <body>
    <div
      id="loader"
      style="
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        align-content: center;
        justify-content: center;
      "
    >
      <div class="lds-dual-ring"></div>
    </div>
    <div id="result"></div>
  </body>
</html>

1 Like