Conversation
|
💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe. |
There was a problem hiding this comment.
PR Summary
This PR significantly updates the Chat UI, addressing the issues mentioned in #341 and introducing new features to enhance user experience.
- Improved contrast and padding in chat messages (src/styles/chat.css)
- Redesigned ChatInput component with dynamic height adjustment (src/components/Chat/ChatInput.tsx)
- Added loading animations for better user feedback (src/utils/animations.tsx)
- Implemented collapsible 'Recents' section in ChatsSidebar (src/components/Chat/ChatsSidebar.tsx)
- Introduced new color variables and custom font in tailwind.config.js for consistent styling
10 file(s) reviewed, 17 comment(s)
Edit PR Review Bot Settings
| text-base | ||
| text-white shadow hover:bg-neutral-300 hover:text-black`} | ||
| className={`mx-1 mt-2 | ||
| h-[100px] max-w-[200px] cursor-pointer rounded-lg border |
There was a problem hiding this comment.
style: Consider using Tailwind's aspect-square class instead of fixed height for better responsiveness
| [setCurrentChatHistory], // Add any other dependencies here if needed | ||
| ) | ||
|
|
||
| /* eslint-disable */ |
There was a problem hiding this comment.
style: This function is marked with eslint-disable. Consider addressing the linting issues instead of disabling eslint.
| /* eslint-disable */ | ||
| useEffect(() => { | ||
| // Update context when the chat history changes | ||
| const context = getChatHistoryContext(currentChatHistory) | ||
| setCurrentContext(context) | ||
|
|
||
| if (!promptSelected) { | ||
| setLoadAnimation(false) | ||
| setLoadingResponse(false) | ||
| } else { | ||
| setPromptSelected(false) | ||
| } | ||
| }, [currentChatHistory?.id]) | ||
| /* eslint-enable */ |
There was a problem hiding this comment.
style: This useEffect hook is also marked with eslint-disable. Consider addressing the linting issues.
| if (promptSelected) { | ||
| handleSubmitNewMessage(undefined) | ||
| } | ||
| /* eslint-disable-next-line react-hooks/exhaustive-deps */ |
There was a problem hiding this comment.
style: This eslint-disable-next-line comment suggests there might be a dependency array issue. Review the dependencies for this useEffect hook.
| /* eslint-disable-next-line react-hooks/exhaustive-deps */ | ||
| }, [appendNewContentToMessageHistory, loadingResponse, currentChatHistory?.id]) |
There was a problem hiding this comment.
style: Another eslint-disable-next-line comment. Consider addressing the dependency array issue for this useEffect hook.
src/styles/chat.css
Outdated
| } | ||
|
|
||
| .chat-container p { | ||
| font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif, "Helvetica", "Apple Color Emoji", Arial, "Segoe UI Emoji", "Segoe UI Symbol"; |
There was a problem hiding this comment.
style: long font-family declaration may benefit from being defined as a CSS variable for reusability
There was a problem hiding this comment.
this is very similar to tailwind builtin font-sans
| background-color: rgb(50, 50, 50); | ||
| color: rgb(220, 220, 220); |
There was a problem hiding this comment.
style: consider using CSS variables for colors to maintain consistency and ease future updates
| .assistant-chat-message { | ||
| color: rgb(210, 210, 210); |
There was a problem hiding this comment.
style: assistant message lacks background color, which may affect readability on different themes
| @keyframes dropdown-fadeIn { | ||
| from { | ||
| opacity: 0; | ||
| transform: translateY(0); | ||
| } | ||
| to { | ||
| opacity: 1; | ||
| transform: translateY(10px); | ||
| } | ||
| } |
There was a problem hiding this comment.
style: animation transforms from 0 to 10px, which may be too subtle. Consider increasing the distance for a more noticeable effect
| <span className="animate-bounce">.</span> | ||
| <span className="animate-bounce delay-200">.</span> | ||
| <span className="animate-bounce delay-[400ms]">.</span> |
There was a problem hiding this comment.
style: Extract delay values to constants for easier maintenance
src/components/Chat/Chat.tsx
Outdated
| <img src="/src/assets/reor-logo.svg" style={{ width: '64px', height: '64px' }} alt="ReorImage" /> | ||
| </div> | ||
| <h1 className="mb-10 text-[28px] text-gray-300"> | ||
| Welcome to your AI-powered assistant! Start your first conversation or pick up where you left off. |
There was a problem hiding this comment.
I think the second sentence after exclamation should be:
Start a conversation with your second brain...
| const [userTextFieldInput, setUserTextFieldInput] = useState<string>('') | ||
| const [askText] = useState<AskOptions>(AskOptions.Ask) | ||
| const [loadingResponse, setLoadingResponse] = useState<boolean>(false) | ||
| const [loadAnimation, setLoadAnimation] = useState<boolean>(false) |
There was a problem hiding this comment.
it seems like we use loadingResponse and loadAnimation as basically the same thing - could you remove one of them please?
There was a problem hiding this comment.
They're not the same thing. loadAnimation is the state that triggers the LoadingDots when we are waiting for a response from streamingResponse. If you use a remote API or have a slow machine, then the latency is very apparent and there needs to exist some way to know that everything is working properly and the LLM is going to send a response. loadAnimation gets set to false on the very first receive from streamingResponse
loadingResponse continues until we are completely done from getting a response from the LLM. That is to say that loadAnimation stops on the first data received, while loadingResponse stops at the very end. It's purpose is to prevent the user from submitting another message or input while we are still streaming.
There was a problem hiding this comment.
ah gotcha. In that case to make the code easy to understand perhaps using a union type for all the states in loading response would be nice?
There was a problem hiding this comment.
thanks for getting this together -Some queries:
- Noting here the feature that was recently added for copying chat output to clipboard and creating file from chat output has been lost
- Could you merge main into this so that we can properly test the changes
- The prompt suggestions should be more semantic-retrieval prompts like "What have I written about philosophy", "which politicians have i discussed positively" rather than the ones you've added which would not retrieve anything useful from the users notes
tailwind.config.js
Outdated
| }, | ||
| fontFamily: { | ||
| // "material-icons": ["Material Icons"], | ||
| 'styrene': [ |
There was a problem hiding this comment.
do we use this font?
There was a problem hiding this comment.
it seems like we define a very similar set of prompts above in the chat-container p css
There was a problem hiding this comment.
looks great @milaiwi
Tiny point: I think we need a "Send" or "Ask" button in new chat - but this can come alongside the work to improve the context settings for chat
I've also added a comment on the css/tailwind
|
/tip $30 @milaiwi |
|
@milaiwi: You just got a $30 tip! 👉 Complete your Algora onboarding to collect your payment. |
|
🎉🎈 @milaiwi has been awarded $30! 🎈🎊 |
|
I'll fix this up and make the last commit |
closes #341
/claim #341
Lots of changes. I've tested as much as I can on my side, but let me know if you run into any issues. Some things to look out for:
responsecomes inI believe I covered all of this, but since I made lots of changes I might have missed something.
Changes
streamingResponseTextAreatotextareaon ChatInput since it's more dynamic when it comes to CSScurrentChatHistory.displayableChatHistoryThings to look for
Tooltip, and phantom tabs.Future Addition
streamingResponsewhen we no longer need the content. Right now, there is no way to stop it fromstreamingResponseso if we change tabs we have to wait for our content from finish appending. I can make a post on this if you want.