Example AI Chat TUI in Go with Charm

The team at charm has built a really great suite of tools to make TUIs.

I'm working on a project similar to aider. My first landmark was to get the shell of a TUI for chatting with AI.

There's a lot of weird go channel stuff you have to do to get streaming to work right with the Elm architecture in Go. This example could be a good jumping off point for weird TUI assistants you want to build.

Right now it has:

  1. An input where you enter your user message and then press Enter to send
  2. A chat window that streams the output from openai
  3. You can Ctrl + C to stop current output and Ctrl + D to exit

All in about 200 lines! Charm is such a fun tool.

Check it out if you're curious.

#AI #charm #golang