Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Copilot.tsx #85

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

RohanMishra315
Copy link
Contributor

@RohanMishra315 RohanMishra315 commented Feb 15, 2024

PULL REQUEST

DESCRIPTION

These enables users to preview and reference previous chat messages easily by fetching the names of previous chats and allowing users to select a chat from the list. Once a chat is selected, the code fetches and displays the messages of the selected chat, allowing users to review and refer to earlier parts of the conversation.

CHANGES MADE

  1. Added a state variable chats to store the names of all available chats and state variable currentChatIndex to keep track of the index of the currently selected chat
  2. Added a handleChatSelection function to handle the selection of a chat
  3. Updated the Ui

This PR fixes ##59

RohanMishra315 and others added 2 commits February 15, 2024 22:45

These  enables users to preview and reference previous chat messages easily by fetching the names of previous chats and allowing users to select a chat from the list. Once a chat is selected, the code fetches and displays the messages of the selected chat, allowing users to review and refer to earlier parts of the conversation.
@jwafu jwafu self-requested a review February 16, 2024 00:21
@jwafu jwafu added the enhancement New feature or request label Feb 16, 2024
@jwafu jwafu linked an issue Feb 16, 2024 that may be closed by this pull request
Copy link
Contributor

@jwafu jwafu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking great, going to test really quick before merging but then should be good. looks great from this end

@@ -113,6 +113,9 @@ export function CopilotChat(): React.JSX.Element {
const [chatSelected, setChatSelected] = useState('-- no chat selected --');
const [chatInputData, setData] = useState('');
const [message, setMessage] = useState<string>('');
const [chats, setChats] = useState<string[]>([]); // State variable to store chat names
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@jwafu
Copy link
Contributor

jwafu commented Feb 16, 2024

Screenshot 2024-02-15 at 7 27 12 PM

Looks like there is a bit of visual challenge here, would you mind looking into this? @RohanMishra315

// Function to handle chat selection
const handleChatSelection = (index: number) => {
setCurrentChatIndex(index);
setChatSelected(chats[index]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this is working properly, but we need to do a little bit of work to the UI so that all of the other chats are are not showing with buttons as well. let me know what you are able to find 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK,I'll look into that

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend just making the top bar that shows all the conversations scrollable. Set a max width and then allow a user to scroll horizontally 👍

@mason-at-pieces
Copy link
Collaborator

Hey @RohanMishra315 could I get an update from you on the status of this pr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to Preview Previous Chat in Copilot Chat
3 participants