Little ChatGPT Helper

Hello everyone,

I’m not entirely certain which forum is the most appropriate for sharing my latest project, so I hope it’s okay to post it here. Over the weekend, I created a small tool that utilizes the ChatGPT API. I’m finding it incredibly useful for editing and rewriting snippets of text that I use throughout my day, as I often struggle with non-code writing. I suspect this might be an ADHD thing.

The tool operates on templates, which can be easily edited as needed. I’ve included a few screenshots to give you an idea of how it works. So far, I’ve found it particularly helpful when it comes to revising my software’s alerts and UI text to better align with Apple’s HIG guidelines.

Thank you for taking the time to read this post.

5 Likes

That’s cool! Love seeing people come up with new ways to put GPT and other AI to work.

2 Likes

waou nice, sine i’m a bit adhd myself, i can understand this :laughing:

yes nice use case ! will you make it available at some point ?

Thank you. Yes, it will be in the Mac App Store. No subscription, maybe an IAP to enable history/logging. BYO OpenAI API key or something like that.

FYI

Summerize should be Summarize

2 Likes
  1. Add a new Class to your Project with the URLConnection Super.
  2. Add a Public Method to your Class, like the following one:
Public Sub TextCompletion(Prompt As String)
  Var EndPoint As String = "https://api.openai.com/v1/completions"
  
  Self.RequestHeader("Authorization") = "Bearer " + Self.OPENAI_API_KEY
  
  Var json As New JSONItem
  json.Value("prompt") = Prompt
  json.Value("model") = "text-davinci-003"
  json.Value("temperature") = 0
  json.Value("max_tokens") = 60
  json.Value("top_p") = 1
  json.Value("frequency_penalty") = 0.5
  json.Value("presence_penalty") = 0
  
  Self.SetRequestContent(json.ToString, "application/json")
  
   Self.Send("POST", EndPoint)
End Sub
  1. Add a Public String Property named OPENAI_API_KEY to your Class
  2. Now add your Event Handlers and process your API Results. :slight_smile:
4 Likes

Thank you for sharing how to use the API in a simple way. It’s great to see how easy the API is to implement in XOJO. Just to clarify, my previous message was about creating a useful tool around the API, specifically a store version, which requires more effort.

2 Likes

I should comment that although XOJO makes pure coding/class/architecture/system a pleasure, especially with the integration of these network classes, the wall for me is usually UI. I started to hit the wall with the settings view—complex layouts are hard to design in the IDE (no baseline alignment, no stack views) but fully hit the wall yesterday with Listbox, with the awkward edit field vertical alignment and text field that doesn’t fully cover the row selection. All known issues so no use recBut fortunately we have plugins or home-grown solutions for these rough edges. :sweat_smile:

1 Like