DEV Community

Rachit Chawla
Rachit Chawla

Posted on

Release 1.3 Contributions: ChatCraft.org

Continuing sheriff duties

Till Wednesday, I had to keep up my role of being a sheriff and actively monitoring PRs and issues, keeping a track of showstoppers, actively checking discord or GitHub mentions in case someone needs help. Overall, it was a great experience for being a sheriff. Got some feedback to work on for more actively checking for mentions.

Issue 388 - Allow sharing a Message vs. Chat

Started work on #388. Had to read the source code to find out the flow of the functions and how stuff is working for share chat function. Started looking from the UI file ChatHeader.tsx

185

Found that at the end its using useDisclosure() function to trigger ShareModal component accordingly.

Share modal

Further, this ShareModal component was calling share function which was a method of ChatCraftChat model

share function called

Share function from ChatCraftChat model below was calling another createShare() function which was another lib created.

share func

Found the logic for creating shared chat - share.ts

Till the time I got here, and understood the function, I got to know that there is another showstopper which would also be required to fix before I could work on sharing chat and actually test it. As I already had a look through the share logic I assigned the bug fix to myself and started working on it.

Issue 446 - ChatCraft 'crashes' when accessing Shared Chats or Searchbar

Had to stop working on the previous issue and start debugging for the bug fix #446 .
The steps I followed for debugging were:

Checking the console logs

After reviewing console logs at the time of bug I found the below

{
    "status": 404,
    "statusText": "Not Found",
    "internal": true,
    "data": "Error: No route matches URL \"/api/share/Rachit1313/<chatId>\"",
    "error": {}
}
Enter fullscreen mode Exit fullscreen mode

whereas my professor confirmed that the chatId is correct and it exists in the R2 bucket.
Also, there was another error found while trying to access the shared chat through the link generated

{
    "_e": {},
    "name": "DataError",
    "message": "Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.\n DataError: Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.",
    "inner": {
        "stack": "Error: Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.\n    at https://chatcraft.org/assets/index-sGYt3Ste.js:425:30652\n    at Kq (https://chatcraft.org/assets/index-sGYt3Ste.js:424:3694)\n    at new Be (https://chatcraft.org/assets/index-sGYt3Ste.js:424:3190)\n    at Object.get (https://chatcraft.org/assets/index-sGYt3Ste.js:425:30599)\n    at c.<computed> [as get] (https://chatcraft.org/assets/index-sGYt3Ste.js:425:51078)\n    at https://chatcraft.org/assets/index-sGYt3Ste.js:425:6066\n    at s (https://chatcraft.org/assets/index-sGYt3Ste.js:425:5768)\n    at https://chatcraft.org/assets/index-sGYt3Ste.js:425:4706\n    at m0 (https://chatcraft.org/assets/index-sGYt3Ste.js:425:3473)\n    at qc (https://chatcraft.org/assets/index-sGYt3Ste.js:425:2313)"
    }
}
Enter fullscreen mode Exit fullscreen mode

Checking the PRs preview URL

Going further, I started checking the all the recent PRs preview to test which PR broke the sharing chat functionality. Found out to be #431. I wasn't able to produce this bug locally as I had no idea how to be loggedIn to ChatCraft while accessing locally. One of my classmate helped me out and told me that we can access ChatCraft locally as logged in user by using the command below:

pnpm dev-functions
Enter fullscreen mode Exit fullscreen mode

Before I could go ahead, My professor, David Humphrey found the issue and made a PR #469 and the bug was fixed. The issue he found was :

The way the data was being passed down from the new loader is different (the old way meant it received a chat id, the new way gets an object)

PR461 - show delete submenu only when there is more than 1 delete option

Another issue I worked on this week was #444. This is was a small one and an easy UI related fix. I recently implemented Delete SubMenus and we had 3 different types of delete buttons : Delete before, Delete After, Delete message. The issue wanted to me add a condition that don't show a submenu if there's just one delete possible i.e Delete message. I added the condition and made a PR #461. just had to take some feedback for a better code approach and made the changes, got this merged.

Issue 453 - Chat Area and Prompt Menu are not aligned perfectly

Based on the issue, We had a misalignment of around 5px in Chat messages and the PromptForm.
align

I found that I could not reproduce this issue in my mac but could see this in a monitor with a windows. Tried fixing it with PR #462 . Later Amnish found that this issue is due to scroll bar and we won't be able to fix it as its based on platform and scroll bar size. We just closed the issue as it coudn't be fixed.

Issue 377 - Integrate scrape2md into CloudFlare proxy function

ChatCraft's owner created another lib scrape2md which helped us convert URLs to markdown for chatcraft or any other llms to be able to parse the data. As a first step to this integration, I had to publish the scrape2md lib to npm to be able to import and use it. I created a PR scrape2md-old #1 which setup its package.json accordingly to be published to npm, a workflow which would build, test and publish the package to npm using NPM_TOKEN which taras(ChatCraft's owner) had to setup in the repo's secret. In addition to that I added unbuild as a devDependencies to the project to build that in js dist folder to be able to published to npm.

Happy Coding🚀🚀

Top comments (0)