Forem

Amir Mullagaliev
Amir Mullagaliev

Posted on

Sprint 3: Results

Table of Contents

  1. Introduction
  2. Follow-Up Issue
  3. Follow-Up PR
  4. New Issue
  5. Conclusion

Introduction

This sprint wasn't as productive as last one. We reached the equator of the term which indicates that midterms are hitting.

Unfortunately, I wasn't able to focus 100% on this sprint, but some work has been completed. I spent some time trying to implement reasoning for the openrouter models, but I couldn't even make it locally.

Therefore, I have to either pass on it or have a meeting with professor and get directions. Anyways, we have some things I've done so far, and I would like to share it with you.

Follow-Up Issue

Suddenly, while I'd been preparing for the midterms, I received a notification from GitHub, and there was new issue, opened by professor.

Multiple Files with same Name in File Attachment UI #829

I'm trying to debug #812, and I'm pasting in images that are different, but have the same "image.png". I successfully get multiple files in the chat, but the UI only shows a single image, I assume using the filename as key vs. the id?

Image

We should show these files, since they all exist and/or add a -1 or -2 to the end of the filename when we import it.

cc @mulla028

As we can see, professor caught a problem that flows from one of PRs that introduces modal with files container UI.

The main problem is, if I try to attach file to the chat, and it has the same name as existing file, it wouldn't appear.

Follow-Up PR

Eventually, I implemented a new utility function that checks if the file names are the same, and adds (1) to it. The same way, as it happens to the files on Windows, if they are in the same folder.

Here's my PR:

[FIX] Unique File Name #834

Closes #829

Description

As per linked issue, we have a problem. If we try to attach file with the same name as the file in our file system, we wouldn't able to see new file, but we would see it in local storage. This PR fixes it by generating a unique name(-1, -2 etc.) to the end of file name, in case when we have file names duplication.

Screenshot

image

New Issue

Recently, Professor landed PR that introduces <ChatProvider /> context and associated useChat() hook:

Add useChat() hook and ChatProvider context #822

Fixes #818, adding a new <ChatProvider /> context and associated useChat() hook. We can use this to access the current chat anywhere in the React tree without props.

After this lands, it would be nice to refactor our code to not bother passing the chat via props all the time.

You can test this by trying to have the LLM write SQL that references one of the files or tables in DuckDB (e.g., select * from chatcraft.chats) and then clicking the run button to execute it.

Our project requires a huge refactor. We have to utilize useChat hook in order to get rid of pass chat on props in majority of components.

I opened new issue. It is my back-up plan for further sprint. In case, if I don't figure out how to include reasoning to openrouter models.

Issue:

Refactor Code To Use `useChat()` Hook #835

Description

Since @humphd landed #822, introduced ChatProvider & useChat() hook. We need to refactor code to stop passing chat on props in components and utilize useChat() hook wherever it's possible .

Conclusion

I am not satisfied by the work done in this sprint. However, it is miracle that I managed to do something. Sometimes things aren't going as planned :/

Top comments (0)