Sprint 3 Result
For this sprint, I manage to finish the worked I was assigned to and create the pull request for them, just waiting for reviews on them now. To make sure that they are properly tested and I didn't leave anything out. To elaborate, on this sprint I was assigned to detangle the chat completion part of chat base class. It was attached to the onPrompt part of the ChatBase. If I were too want to make a new chat response on another part of the code, I would have to do most of the things done in onPrompt to implement it. So to make things easier and cleaner, its better to move the chat completion part of the chat class or make it as a hook. Making it as a hook allows it to be easily used anywhere it the code.
Issue: #820
How I started is that, I tried to migrate all of the necessary codes from the onPromt in chatBase to the new method in ChatCraftChaft class, so to create a new response just needs to be chat.completion()
. It was mostly done by copying everything that I would need. For the most part, didn't encounter much issues expect when I was using the wrong import.
For the longest time, I could not get the commands to work like how it was originally. Almost everything was copied over so their shouldn't be much of an issue. It turns out when I was creating the imports, I used the auto imports and it used the same class from another file that has the same class name. I was using
import { ChatCraftCommandRegistry } from "./ChatCraftCommandRegistry";
when I should be using
import { ChatCraftCommandRegistry } from "../lib/commands";
This thought me that I should check if I'm using the right imports and try not to use the same name for classes on other files.
Another one particular issue is that I would need to pass in the hooks that was needed. Since I could only use hooks in React functions or on custom React hooks. So I ended up with a method with cluttered variables,
chat.completion(prompt ?? "", chat, user, settings, chatApi, error);
. This wasn't particularly ideal but it works. I looked for ways for hooks to be used in the method without passing them in. But it required changing the general code too much.
Though when I was looking into React Hook, I found that its easier and cleaner to do this if I turn this into a hook. I use the hooks directly inside which reduced the variable needed. Creating a new chat response now just
chatCompletion(prompt, chat)
. This way it is easier to access else where in the code. PR
The Review
I was requested to review one of the pull request, [FIX] Unique File Name. This one wasn't too hard to review. I was able to follow what's going on with the new addition. Everything seems to be fine with it, at least with what I can surmise.
Though from reviewing this, I found a couple of bugs. Not caused my the pull request but something else. First bug I found is that when attaching a new file and removing them, causes the attach button to break and require a page refresh to work again.
Another bug is when adding a new file from an empty list of file in the attached file window, the add file button breaks.
I will be creating issues for these.
This sprint was a learning experience, I learned how hooks functions and how to create them, and reviewing pull request can lead to discoveries. Either discovering bugs or something new to learn.
Top comments (0)