-
Notifications
You must be signed in to change notification settings - Fork 366
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
Chat: allow large file with range in @-mentions #3619
Conversation
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.
edit: uploading proper 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.
The @ file with line numbers still got excluded in the context, did I test this correctly?
also, it feels a bit weird to backspace after hitting tab/enter to enter in the line numbers, would it be better for large files to not have that empty space and let the user start selecting the line numbers right afterwards?
large-file-excluded.mp4
I don't think that's related to my changes in this PR, since we can see the file was appended to the chat correctly, but got excluded by the chat context window since i suspect it's because you are using the smaller claude 3 model? Can you try Claude 3 Opus? Mentioned in the Limitation section about more work need to be on the range for large files as well, which we can look into when we start the works on context windows? We did add a UI to display when an @-file is excluded tho |
I think the current limitation is a bit confusing for the user, I don't know who to trust if I'm able to @ file a large file with range but the UI says it got excluded from context 😓 @toolmantim @chillatom what do you all think? I think we need to address the limitations section either in the same PR or a follow up right afterwards |
It was part of @toolmantim 's design and the engineering work on "We should not silently exclude a file that has been explicitly @ mentioned" 😅 We also have users asking to enable to @ line numbers again after we have disabled it on large files: #3523 & https://discord.com/channels/969688426372825169/1222845844563296317 @toolmantim @chillatom @kalanchan I'll need more information on how we want the context window works before we can address this limitation too. I've sent you all an invite for next week so we can discuss live! Edit: I've also added some new issues to this tracking issues https://github.com/sourcegraph/cody-issues/issues/9 |
@kalanchan You were right there was a bug with the display logic where used @-mention items are showing up as excluded when the file was originally too large. That's why in your screenshot Cody was still able to answer the question. I've fixed that so that all used files shouldn't be marked as large file: Also updated to include |
@toolmantim @chillatom updated the PR so that it matches the behavior we discussed earlier for Wednesday release: selecting a large file from the option list will add the file path to the input as text so that users can choose to add range after the auto-filled file path or remove it. Selecting files that are not large file will automatically turn it into a token. Follow-up from this would be allowing users to add selection from editor as @-mentions via right click menu. (Related issue: #3612) Let me know if I'm missing something here, thanks! |
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.
Looking good! I found a few things:
-
Items shouldn't look disabled now they're clickable.
Can we bring back up the opacity and cursor etc?
-
When you select an item, can we complete the path, add
:
to the end, make sure it's the only item in the menu, and give them some hint for how to type the range? At the moment you need to manually type the:
and then it starts doing a line-range to all items:
-
When you add
:
can we replace the "File is too large ..." file subtext with something more helpful like "Type a line range to include, e.g. 1-42": -
Let's remove the "File will be excluded if context range exceeds limit" message. Could we implement a maximum number of lines you can do, and only if they exceed it we show the message, rather than warn everyone ahead of time?
-
If you type a line range (e.g.
:1-42
) and remove the lines, leaving only:
, it seems to show an old cached value:
@toolmantim @umpox Thanks for the review! I've updated the PR to address the following changes:
@umpox This is only updating the UI for chat, so I don't suppose the changes in this PR will work with Edit which uses a different UI. Will create an issue for Edit Demoupdated.mov |
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.
Code LGTM with comments, have not tried this yet but I see other people have
vscode/webviews/promptEditor/plugins/atMentions/OptionsList.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Quinn Slack <[email protected]>
@@ -72,7 +72,7 @@ | |||
background-color: var(--vscode-list-hoverBackground); | |||
} | |||
.option-item.disabled { | |||
opacity: 0.5; |
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.
Yeah, let's not change the opacity at all, as we have the label and don't want it to feel disabled. We could create a custom icon if we really wanted, but I think the label is good.
We could add a right chevron to the right hand side ">" to show that you don't be in fact selecting the item, but "going into it"
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.
@toolmantim Thanks! removing opacity in #3665
CLOSE: #3589 (comment)
PART OF: https://github.com/sourcegraph/cody-issues/issues/9
Demo
updated.mov
This pull request updates the prompt editor to allow large files to be added to the context when they have a specified range. Previously, large files were not allowed to be added to the context file list. Now, large files with ranges can be included in the context.
##Changes
Update contextItemMentionNodeDisplayText in ContextItemMentionNode.ts:
Update Item component in OptionsList.tsx:
Update MentionsPlugin in atMentions.tsx:
:
after the file path to allow adding line range.Limitation
Users will not see the large file warning on large file with range input because we will need to get the range numbers first before we can check the token usage, which should be part of the works when we start working on improving our context window logic.
Tracking issue: https://github.com/sourcegraph/cody-issues/issues/9
Test plan
Search for a large file via @-mentions:
Press tab, verify
:
is added to the end of the file path. And then add file range:Hit tab / space again, and the large file is now added as a context item token:
Verify that selecting files that are not too large should automatically add to input box as token.