-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Improve / fix arrow keys for Cody history #51586
Conversation
Bundle size report 📦
Look at the Statoscope report for a full comparison between the commits d46f1ab and 0023755 or learn more. Open explanation
|
b395460
to
fb1fa81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving from VS Code side, but I think @thenamankumar you should look at Web.
client/web/src/cody/CodyChat.tsx
Outdated
@@ -74,6 +74,16 @@ export const CodyChat = ({ onClose }: CodyChatProps): JSX.Element => { | |||
} | |||
}, [transcript, shouldScrollToBottom, messageInProgress]) | |||
|
|||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems wrong. transcriptHistory is transcriptJSON[]
. It is the list of conversations not a list of chat messages belonging to a single transcript.
I guess what you want to do is:
transcript
.filter(message => message.speaker === 'human' && !!message.displayText)
.map(({displayText}) => displayText)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe my code is the desired behavior as history navigation in VSCode goes through all user inputs for all past conversations, not just the current transcript. (But I'd be happy to switch to the behavior you mentioned if you believe that's the right course of action :))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't experienced it in VS Code yet, will you be able to share a demo video regarding how this will behave on the web when you populate inputHistory with messages from all the previous chats and not just the active chat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for asking this Naman, it actually unearthed an odd behavior where only the current chat's messages are populated. I'll look into this.
EDIT: It's because transcriptHistory seems to contain messages like [A, B, C, A, B, C, D, E] where the first C is where I stopped the conversation before reloading the page. Figured it out: there was a incorrectly formatted conversation in there from a long time ago, everything's working great now - I'll send a demo video!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
fb1fa81
to
cfc87fa
Compare
Heads up: looks like you're getting a TypeScript compiler error
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noice! This works very well (tested in VS Code). The old behavior was really buggy and confusing.
Don't forget to add a change log entry :)
Thanks @SuperAuguste! |
Closes #51575. Some issues that were fixed: - Down arrow did not navigate history forward - You couldn't navigate the WIP prompt with the up arrow as it would navigate history always; now we only navigate to backwards when the up arrow is pressed at the start of the prompt and forwards then the down arrow is pressed at the end of the prompt - There was a typo that prevented the history index from being set properly in VSCode - Input history wasn't populated on the web ## Test plan Tested history navigation in VSCode and web.
Closes #51575.
Some issues that were fixed:
Test plan
Tested history navigation in VSCode and web.