Add multi-repo context selector to Cody Web#53046
Conversation
b109cc5 to
0460540
Compare
da2e05c to
b59f9b0
Compare
Minor fixings
Screen.Recording.2023-06-06.at.9.48.51.PM.mov
Desirable changes
|
|
@toolmantim, I think we'll need that 'Clear all' button in this UI. Look at how many clicks a user should have to clean the context and start over. Screen.Recording.2023-06-06.at.10.00.49.PM.mov |
There was a problem hiding this comment.
Any particular reason that this formatted with backticks instead of just the repo names?
If i understand this right, this will e expanded to something like this:
You have access to the `sourcegraph/sourcegraph, sourcegraph/cody repositories'`. You are able to answer questions about the `sourcegraph/sourcegraph, sourcegraph/cody repositories'`.
Which feels a bit unnatural to me (may be fine though, the LLMs are smarter than I am :D)
There's also a lot of repetition of the codebase var going on. If this holds e.g. 10 repos, this might contribute a lot to the prompt already. Maybe we can simplify this a bit?
There was a problem hiding this comment.
Updated the template based on your suggestions.
There was a problem hiding this comment.
I see await here. One issue that we repeateldy run into again is that if we start to await anything in the recipe execution path, it would often cause a delay after a message is submitted and before the loading indicator is displayed in the UI. Is there a way to refactor this to not require async code paths in this branch?
There was a problem hiding this comment.
This promise, will ideally be already resolved. We fetch repoIDs, whenever the context is changed and cache it. Because the type is still a promise, we need to await it here as well. But by the time the user enters the message, it should already be resolved. There should be only 1 event loop delay.
There was a problem hiding this comment.
I’m not really sure what's gping on here. Is this adding the inferred context? If so, should this all be behidn an if(scope.includeInferredFIie)?
There was a problem hiding this comment.
Yeah this can be confusing. I'll add comments in the code as well.
So basically, we allow users to disable inference of the current file and repo right? But what if they use the editor widget? The editor recipes still need the context of the current repo & file.
So here, if we are getting options.scope.editor as an argument of executeRecipe, we make sure the repo & file is included irrespective of includeInferredRepo/File.
There was a problem hiding this comment.
Should this always be created or only if the unified scope is set?
There was a problem hiding this comment.
This is only for web and it uses unified scope. If other clients use this is future we can make it dynamic.
There was a problem hiding this comment.
I’m a bit out of sync on the latest architecture but is this file used only for web or also for vs code?
There was a problem hiding this comment.
The indentation in this file is a mix of tabs and spaces
There was a problem hiding this comment.
I’m a bit confused by this hook. Does it mean if scope changes, we setScope? 🤔
There was a problem hiding this comment.
We are checking for scopeInitialized so it will only happen at load.
There was a problem hiding this comment.
I wonder if this abstraction still makes sense if 80% of the classes that implement this interface have most of the API calls stubbed out 😅
There was a problem hiding this comment.
Lol yeah. I think this will improve in-future when we have extensions for other IDEs building in TS. As the code is shared, we need to keep it for now.
There was a problem hiding this comment.
Should we instead of constructing a HTML string return JSX here? We can't use .replace, granted, but we can just loop over the regex matches manually and return a fragment maybe?
I’m worried that this code is reused for something else in the future and then the item may contain XSS vulnerabilities
60bfcbf to
a4b1235
Compare
- Add multi-repo content selector to Cody Web based on [Figma](https://www.figma.com/file/HnUQ9Rf7GYDtHsFBnNdjM1/Cody%E2%80%99s-Context-Scope?type=design&node-id=53-518&t=NmT0MUWyx6zG8emz-0) designs. - Auto-infer scope from currently opened markdown files. - Auto-infer readme.md content from the repo home page. https://www.loom.com/share/340bd0e72bc5477ab517ce8143838a47 ## Test plan - visit /cody - click on add repostiories - search of repos & select - ask cody a question - reload page the the context should persist

https://www.loom.com/share/340bd0e72bc5477ab517ce8143838a47
Test plan