In my last post, I discussed how I integrated Text to Speech support into ChatCraft using OpenAI's TTS API.
In this post, I'll share my progress on that Pull Request and other contributions I made as a part of releasing v1.1 of the project.
Table of Contents
1. Text to Speech Support
2. Filing and fixing follow ups
2.1. Using Better icons for TTS button
2.2. Fixing TTS toggle behaviour
2.3. TTS should abort when switched off
3. Helping with migrating the Menu Component
3.1. Suggesting changes on GitHub
3.2. Pushing Fixes
4. Reviewing a Pull Request
5. Release v1.1 🚀
Text to Speech Support
Before talking about other contributions, I was able to get an initial version of text to speech landed successfully after a few discussions and changes.
My professor was a little confused why I was managing Promises of audio urls instead of directly storing url strings in my audio queue. I tried to explain it with the help of an example.
Here's the link if you're interested:
https://github.com/tarasglek/chatcraft.org/pull/357#discussion_r1473470003
I embedded a video demo in my last post, and you can try it yourself by visiting ChatCraft.
It was not perfect by any chance, and so I had to open a couple of follow up issues aimed to fix the technical shortcomings.
- https://github.com/tarasglek/chatcraft.org/issues/386
- https://github.com/tarasglek/chatcraft.org/issues/387
As soon as it was merged, I started receiving more feedback that I couldn't even get in original reviews because now people were forced to use it 😉.
And so, it was time to file even more follow ups aimed to address the issues brought up by Taras.
Filing and fixing follow ups
Various issues were encountered after my PR was merged.
Using Better icons for TTS button
The first one was that the icons I used for TTS enable/disable button didn't do a good job at indicating the state of the feature.
I quickly opened an issue for that
and replaced the icons with Material Design variants as suggested.
After a quick review, the Pull Request was merged.
Time to look at the other issues!
Fixing TTS toggle behaviour
The next thing on the list was a little annoying for the users.
You read that RIGHT! For some reason, the text to speech functionality was always enabled no matter if the state of the toggle button.
Another follow up issue had to be opened.
The problem was that I wasn't checking for the TTS setting in the else if branch in the following code:
if (isTtsSupported() && getSettings().announceMessages) {
if (
sentenceEndRegex.test(ttsWordsBuffer) // Has full sentence
) {
// Reset lastIndex before calling exec
sentenceEndRegex.lastIndex = 0;
const sentenceEndIndex = sentenceEndRegex.exec(ttsWordsBuffer)!.index;
// Pass the sentence to tts api for processing
const textToBeProcessed = ttsWordsBuffer.slice(0, sentenceEndIndex + 1);
const audioClipUri = textToSpeech(textToBeProcessed);
addToAudioQueue(audioClipUri);
// Update the tts Cursor
ttsCursor += sentenceEndIndex + 1;
} else if (ttsWordsBuffer.split(" ").length >= TTS_BUFFER_THRESHOLD) {
// Flush the entire buffer into tts api
const audioClipUri = textToSpeech(ttsWordsBuffer);
addToAudioQueue(audioClipUri);
ttsCursor += ttsWordsBuffer.length;
}
}
I quickly opened a Pull Request for the fix.
and felt the need for adding a hotfix
label to the repo
as this sure was one.
TTS should abort when switched off
The third problem was that the TTS announcement always kept playing, even when the feature was turned off using the toggle button.
I filed an issue for that
but still need to work on it.
Here's the state of follow ups so far.
Helping with migrating the Menu Component
The next big thing I worked on this week was helping Rachit with the creation of a new Menu Component for the application using the react-menu package.
Here's some context for you guys.
Rachit was able to get the functionality working for our component wrapper, but needed some help with the styling part.
Since I was asked for help,
I had to get into action.
Suggesting changes on GitHub
The first step was to review behaviour and suggest any initial changes that came to my mind.
I quickly noticed a weird behaviour that did not exist before
I posted a suggestion on GitHub that could be directly committed to fix that issue.
Fixed Behaviour:
We continued with this GitHub Suggestions for a while
Pushing Fixes
Until professor suggested us another approach of collaboration.
This was exactly what I wanted to do, and now that I knew it was acceptable, I asked Rachit if could push directly to his branch. And pushed the fixes for anything I could think of.
For full details, please follow the Pull Request directly. This was the biggest conversation I ever I had in a PR.
Reviewing a Pull Request
Last but not least, I reviewed a Pull Request Katie was working on, that would allow users to store metaData for multiple AI providers at once.
I made a simple suggestion on this one to create a url
to provider name
mapping instead of manually determining provider name with a switch statement.
This suggestion was accepted
And after reviews from professor, this PR was also merged 🎊
Release v1.1 🚀
All this work, was just a part of my contributions for Release 1.1 that happened yesterday.
We have made significant progress if count changes made by all others
and here's one for the new contributors 🍾🥂
Top comments (0)