More Adventures in Open Source Development - ChatCraft
Tags: ai, beginners, chatgpt, opensource
Published: 2024-01-13 04:03:02


## More Open Source
In my final semester, I'm taking another Open Source class. If you've read my blog posts from 2023, you'd have seen my journey in learning open source and contributing to various open source projects. This semester, I'll be doing something different. Instead of contributing to various projects, I'll be using the skills I learned to contribute to one project.


## On ChatGPT
Many readers are already aware of [ChatGPT](https://openai.com/blog/chatgpt) by OpenAI, and have probably used ChatGPT for various purposes. If you've used it for programming help, you may have noticed the responses ChatGPT gives are a little inaccurate not exactly what you ask for. You may have experienced [rate limits](https://platform.openai.com/docs/guides/rate-limits?context=tier-free) or have been signed out and force to log back in to use ChatGPT. In my Open Source class, I will be contributing to [ChatCraft.org](https://chatcraft.org/c/wHG37RtGXYUC1CZXnSIew), an alternative to ChatGPT.


## ChatCraft - An AI Chatbot for Developers
### Inception
[tarasglek/chatcraft.org]
(https://github.com/tarasglek/chatcraft.org) is an open-source, developer-oriented ChatGPT frontend for coding with Large Language Models (LLMs). ChatCraft was started because the author, Taras, experienced the same issues I (and perhaps those reading) have also noticed with ChatGPT (workflow disruptions due to service downtime, having to re-login). The beauty of ChatCraft is that you don't need to login, just paste your API key and you can get started. He also wanted to interactively edit [mermaid diagrams](https://mermaid.js.org/) using GPT, which can't be easily done using ChatGPT or other open soure ChatGPT frontends. More information is available on [Taras' blog](https://taras.glek.net/post/chatcraft.org-opensourcechatgpt-for-devs/).

My instructor, David Humphrey, has worked with Taras to rebuild ChatCraft's UI/UX, which now has a look inspired by GitHub and should bring a familiar experience to developers. You can find David's blog on ChatCraft over [here](https://blog.humphd.org/chatcraft-org/).


## Neat Features
My instructor demonstrated ChatCraft to our class, and I'm already impressed with what I've seen. ChatCraft has some neat features that might interest you:
- Customizable System Prompts
- Multi-vendor Support
- Browser-based
- GitHub-inspired User Interface
- Shareable Chats
- Cost-effective (pay for what you use, no subscription fees)

## Installation
For this week, my task was setting up my development environment and getting access to Secrets using sops. To setup my development environment I followed the instructions in the [CONTRIBUTING.md](https://github.com/tarasglek/chatcraft.org/blob/main/CONTRIBUTING.md). I found the installation instructions easy to follow, and they worked for my Windows 10 machine.

## Managing Secrets using [sops](https://github.com/getsops/sops).
ChatCraft uses sops for secrets management. Being able to access secrets requires uploading a public ssh-ed25519 key to GitHub and getting your GitHub username to a YAML file. 

Instructions for this setup are found in the [README.sops.md](https://github.com/tarasglek/chatcraft.org/blob/main/README.sops.md) file. Following the instructions, I installed the following:
- [go](https://go.dev/)
- [sops](https://github.com/getsops/sops) (using go)
- [ssh-to-age](https://github.com/Mic92/ssh-to-age/blob/main/README.md) (using go).

I'm still learning about sops and ssh-to-age. So far, the only things I know about sops is that it's an acronym for "Secrets OPerationS" and that it's used to handle sensitive data like API keys. As for ssh-to-age, it's a tool that converts SSH Ed25519 keys to another type of key called [age](https://github.com/FiloSottile/age) keys.

## Generating SSH Keys
While I had no trouble installing and setting up ChatCraft, generating SSH keys was a new concept. I found the following GitHub Docs helpful:
1. [Adding a new SSH key to your GitHub account](https://docs.github.com/en/github-ae@latest/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account?platform=windows)
2. [Checking for existing SSH keys](https://docs.github.com/en/github-ae@latest/authentication/connecting-to-github-with-ssh/checking-for-existing-ssh-keys)
3. [Generating a new SSH key and adding it to the ssh-agent](https://docs.github.com/en/github-ae@latest/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)

I advise reading #1 first, and then referring to #2 and #3 when instructed to within #1.

## Course and Project Goals
ChatCraft is an amazing project and I'm grateful for the opportunity to contribute to its development this semester. However, I'm nervous about how much I'll actually be able to contribute. Much of the codebase is in TypeScript, which I'm not too comfortable writing in. I'm planning to do some code reading over the next couple weeks to become familiar with ChatCraft and to get a feel for coding style used. For now, I think I'd be interested in contributing to automation and CI/CD workflows. I'd also like to try adding support for languages using [WASM](https://webassembly.org/). I don't know too much about WASM, but I'm hoping to learn it this semester and to implement it in ChatCraft.

## Next Steps
Over the next few months, I'll be posting weekly updates on my journey and progress in contributing to ChatCraft. I'm very nervous  and have a lot to learn, but I hope with each update my skills improve and I'll have some cool things to share with you. I'm excited to see what these next months will bring.