ChatCraft week 4: Release 1.1 PR
Tags: opensource, chatcraft, typescript, chatgpt
Published: 2024-02-03 04:41:19

---
series: Collaborating on ChatCraft
---

This week of working with the [ChatCraft](https://chatcraft.org) team, it was interesting to see what each team member was working on during our weekly triage meeting. We also, as a team, went through the list of existing issues so that everyone could choose more issues to work on in the future. Today was our first [release](https://github.com/tarasglek/chatcraft.org/releases/tag/v1.1.0) as a team, and I am happy to see my code be a part of it!

#Coding

I broke down the [issue](https://github.com/tarasglek/chatcraft.org/issues/345) I was previously working on into two pieces so that I could get a PR merged in [Release 1.1](https://github.com/tarasglek/chatcraft.org/releases/tag/v1.1.0) which happened today.

#Issue & PR

The [smaller issue](https://github.com/tarasglek/chatcraft.org/issues/383) I created is meant to be a precursor to solving the larger issue of storing info for multiple providers.

In my [PR](https://github.com/tarasglek/chatcraft.org/pull/371), I laid down the foundation for storing the provider information, while not changing any existing behaviour.

Here is what I did:

- Creating the class [`ChatCraftProvider.ts`](https://github.com/tarasglek/chatcraft.org/pull/371/files#diff-163489fb9d67f12a96f71b1a06ec2c3cc41152124ad90c14adcc6ded77869f1a) which stores information for a provider such as provider name, url, key
- Adding the `providers` var to [`src/lib/settings.ts`](https://github.com/tarasglek/chatcraft.org/pull/371/files#diff-b5f5521c9795e314efdf6293ad3afda789a1402bbf5e2a304e20efa8134d2a15), which is an associative array of `ChatCraftProvider` objects
- Adding code to the [`Instructions.tsx`](https://github.com/tarasglek/chatcraft.org/pull/371/files#diff-9fcdb80f3814fd658a3bb7dcaf58478d27938a43cde9049d449210652e77434c) view so that when new [ChatCraft](https://chatcraft.org) users enters a key and clicks the Save button, the provider info is stored to `settings.providers` (thus saved to localStorage)

![screenshot1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/li58tae8jig90mi1bxz9.png)

- Adding code to the event handlers in [`PreferencesModal.tsx`](https://github.com/tarasglek/chatcraft.org/pull/371/files#diff-1025748a16e04005898c20c05840616be48ca0eb4eb4c156248de41a2f3bdd7d) view so that the Settings dialog window will store and remove info from `settings.providers`

![screenshot2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jsptrpc9tbb2ckl99vcz.png)

# Code Changes

I received code reviews from [Dave](https://github.com/tarasglek/chatcraft.org/pull/371#pullrequestreview-1855161179) and [Amnish](https://github.com/tarasglek/chatcraft.org/pull/371#issuecomment-1920306781), and I revised my code after getting their comments.

{% github https://github.com/tarasglek/chatcraft.org/pull/371#issuecomment-1920368076 %}

I was pleasantly surprised that I was able to address all the code changes without needing to ask for help. Being able to refer to previously written code in other files of [ChatCraft](https://chatcraft.org) and having ChatGPT to explain concepts to made my work go faster. My [PR](https://github.com/tarasglek/chatcraft.org/pull/371) was approved and merged as a part of [Release 1.1](https://github.com/tarasglek/chatcraft.org/releases/tag/v1.1.0)!

Next up in release 1.2, I will be completing the original [issue](https://github.com/tarasglek/chatcraft.org/issues/345) in full. This means we will be reading from the list of multiple providers, and users can toggle back and forth between OpenAI and OpenRouter without their API key being cleared.

# Leaving Reviews

I reviewed a [PR](https://github.com/tarasglek/chatcraft.org/pull/369) which was a small UI change revolving around the Speech-to-text Mic button in ChatCraft.

![screenshot3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ffpoogtyeuo7l3kbkmiq.png)

The current behaviour of this Mic button is that you have to hold it and speak and then when you let go, it will transcribe your speed to text and send it to ChatCraft.

This [PR](https://github.com/tarasglek/chatcraft.org/pull/369) is changing the behaviour for mobile to press to start, press to stop, instead of hold to speak. There is also some strange behaviour allowing users to drag the button which is being addressed.

I installed [GitHub CLI](https://cli.github.com/) so I was able to quickly pull the branch code with a simple one-line command.

```
gh pr checkout THE_PR_NUMBER
```

Once I did that I ran and tested it on my local. I left my [review](https://github.com/tarasglek/chatcraft.org/pull/369#pullrequestreview-1856911414) on the [PR](https://github.com/tarasglek/chatcraft.org/pull/369), but I will review it once more when Amnish is done making additional changes to it.