-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Forbid file mentioning for large files #4790
Forbid file mentioning for large files #4790
Conversation
✅ Deploy Preview for continuedev ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
0e6b1e3
to
ed1f842
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.
Generally looks good. I left some comments that should be pretty quickly resolvable
props.command({ ...item, itemType: item.type }); | ||
if (item.type === "file" && item.query) { | ||
console.log(item); | ||
isItemTooBig(item.type, item.query).then(([fileExceeds, fileSize]) => { |
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 think this callback could be broken out into a separate function to reduce the complexity of this logic
core/core.ts
Outdated
const { config } = await this.configHandler.loadConfig(); | ||
|
||
if (!config) { | ||
return true; |
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 want to be very careful that we don't accidentally return true
, so I think this should default to false
. The consequences are pretty bad if we accidentally return true
.
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 spent some time considering whether we should return true
or false
for these situations and I was still not sure when I submitted this PR. I agree that this might be too aggressive to return true
by default.
); | ||
|
||
if (contextResult.status === "error") { | ||
return [true, -1]; |
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.
same here, we should default to false
}); | ||
|
||
if (result.status === "error") { | ||
return [true, -1]; |
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.
here too
I'm still in the middle of something but I'll get the modification done by the end of today! |
ed1f842
to
e8c9592
Compare
Hey @sestinj, I’ve pushed the updated version. Let me know if any further changes are needed for this PR. |
When the context items provided by user overflow the context length and are truncated, it is very confusing for the user. This is a first step that catches an common case at the least confusing time - when the user is selecting a file. A more general check that warns whenever the most recent message is truncated is something that can be added later. Granite-Code/granite-code#22
e8c9592
to
1611bae
Compare
It looks good to me, thanks! |
Description
When the context items provided by user overflow the context length and are truncated, it is very confusing for the user. This is a first step that catches an common case at the least confusing time - when the user is selecting a file. A more general check that warns whenever the most recent message is truncated is something that can be added later.
Granite-Code/granite-code#22
Screenshots
Testing instructions
Select a file that is large enough to exceed
contextLength
-maxTokens
, then the mention should be canceled and a error dialog should pop up.