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

Attribution Chat UI #476

Merged
merged 19 commits into from
Feb 6, 2024
Merged

Attribution Chat UI #476

merged 19 commits into from
Feb 6, 2024

Conversation

cbart
Copy link
Contributor

@cbart cbart commented Feb 2, 2024

Closes sourcegraph/sourcegraph#59335

This pull-request implements attribution search in Chat:

  • Extend the agent API (JetBrains side) to call attribution/search (see Agent attribution API cody#2798)
  • Display a disabled button on hover of chat code editor that presents that status of attribution search text (tooltip):
    • Attribution search () - when still awaiting on whole snippet to be typed in.
    • Attribution search (Guard Rails: Running Code Attribution Check...) once snippet is done typing and search is running.
    • Guard Rails API Error (Guard Rails API Error: ...) if attribution search is unavailable
    • Guard Rails Check Passed (Snippet not found on Sourcegraph.com.) if attribution search finished with no results.
    • Guard Rails Check Failed (Guard Rails Check Failed. Code found in %d repositories ...) if attribution search finished and attribution was found.

Synopsis of main participating classes (in order of appearance):

  • AttributionSearchCommand starts attribution search and then notifies UI of the result.
  • AttributionButtonController drives UI changes of the attribution button.
  • ConditionalVisibilityButton allows for showing the attribution button on hover (visible) only if attribution is enabled (visibilityAllowed)

Besides the UI changes to arrange everything neatly are a little scattered around.

User interface

Visually the indicator is a disabled button to match the current copy/paste at cursor buttons. @danielmarquespt is working on design to match the VS Code UI layout.

Check pending

pending

Check passed

passed

Check failed

failed

Test plan

  • Manual testing
  • Unit tests
  • (stretch) Acceptance Heavy UI test

I gave up on trying to write a component or acceptance test here, since we really need to do the heavy lifting of making this extension testable. This work is beyond the scope of this issue and the timelines we have at this point, but I will come back to that (https://github.com/sourcegraph/sourcegraph/issues/60136)

@cbart cbart marked this pull request as ready for review February 4, 2024 21:42
@cbart cbart requested a review from pkukielka February 5, 2024 08:29
@cbart
Copy link
Contributor Author

cbart commented Feb 6, 2024

All comments addressed, and tested manually again. I've updated the failed tooltip to use ul/li for displaying repos, since that seemed to render better:

Screenshot 2024-02-06 at 9 22 25 PM

@mkondratek
Copy link
Contributor

It looks much better now 🚀

@cbart cbart merged commit 0ca9dbf into main Feb 6, 2024
2 checks passed
@cbart cbart deleted the cb/59335/chat-ui-indicator-proto branch February 6, 2024 20:41
@cbart
Copy link
Contributor Author

cbart commented Feb 6, 2024

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

Successfully merging this pull request may close these issues.

IntelliJ > Guardrails Chat UI
2 participants