Commit Graph

74 Commits

Author SHA1 Message Date
Vova Kulikov
ff6f396abb
Cody web: Bring back old packages from git history (#61376)
* Add cody-shared package

* Add cody-ui package

* Adjust web package and install new deps

* Minor fixes in build bazel

* Configure

* Run prettier

* Run prettier

* Fix linters

* Fix eslint problems

* Update tsconfig refs

* Remove unused code

* Update packages build files

* Update packages build files

* Update packages build files 2

* Remove wildcard from cody-ui

* Attempt to fix bazel file for cody-ui

* Run prettier

* fix cody bazel file

* Update tsconfig refs

* Remove unused/unsupported recipes  from cody-shared
2024-04-08 14:21:41 +02:00
Quinn Slack
006bd2fea3
remove cody code that was moved to separate cody repo (#54729)
Cody code is being moved to https://github.com/sourcegraph/cody. This PR
removes the moved code and configures this repository to use the
`@sourcegraph/cody-{shared,ui}` packages published by the new separate
Cody repository.

## Test plan

Ensure that the new separate Cody repository tests pass. Ensure that
this repository's tests pass now that it uses 2 npm packages published
by the new separate Cody repository.
2023-07-10 00:31:47 -10:00
Dominic Cooney
a7a1db2bb6
Cody: Add some recipes buttons to the welcome message (#54277)
This adds three recipes to the welcome chat message in VScode to help
users get started. Fixes issue #54232 .

## Test plan

Open Cody. A new chat now has buttons. Clicking the buttons starts those
recipes.

---------

Co-authored-by: Beatrix <beatrix@sourcegraph.com>
2023-06-29 21:33:18 +09:00
Beatrix
d19f0e79fb
cody: add support for intel mac and linux (#54405) 2023-06-28 22:32:52 +00:00
Beatrix
e673147ea6
cody: update indexing icons (#54262) 2023-06-27 11:38:00 -07:00
Tom Ross
dc334b83ff
Cody: Fix auto scroll when message in-progress (#54188) 2023-06-27 08:32:26 +00:00
Tom Ross
e881424beb
Show Cody walkthrough help text (#54175) 2023-06-27 09:13:57 +01:00
Philipp Spiess
1457d868e5
Cody: Fix input style issue when the abort button is shown (#54035)
This annoyed me a lot and made the experience feel unpolished: When the
abort button was displayed, the width was set to `100%` which was
causing a horizontal overflow that caused a strange padding on the
bottom to appear:

<img width="555" alt="Screenshot 2023-06-23 at 12 05 35"
src="https://github.com/sourcegraph/sourcegraph/assets/458591/733cc938-6d4c-4e89-a803-d4af02aa7e57">

## Test plan

This PR fixes it:

<img width="535" alt="Screenshot 2023-06-23 at 12 17 20"
src="https://github.com/sourcegraph/sourcegraph/assets/458591/7ee4515a-72cf-419b-b913-1ae48a2beab8">

And works on Web:

 
<img width="631" alt="Screenshot 2023-06-23 at 12 23 45"
src="https://github.com/sourcegraph/sourcegraph/assets/458591/4ddbbd46-5dde-4faa-8c84-496e0e6ed6bb">


<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
2023-06-23 18:00:35 +02:00
Greg Magolan
09d898704a
build: update to Aspect CLI 5.5.2 (#53692)
Required adding a few import ignore directives in
`client/web/BUILD.bazel`. @jbedard is working on a fix for those. Has to
do with tsconfig paths. Fix will land in a future release.

## Test plan

5.4.11 output:

```
$ bazel configure
Updating BUILD files for protobuf, go, javascript
WARN[0000] Failed to load base tsconfig file @sourcegraph/tsconfig: open /Users/greg/aspect/sourcegraph/sourcegraph/@sourcegraph/tsconfig: no such file or directory 
client/app-shell/src/app-shell.tsx parse error(s):
50: Top-level await is currently not supported with the "iife" output format
Failed to parse tsconfig file client/completions-review-tool/tsconfig.json: ERR: position:298 object key must be string pos:298 : 
933 BUILD files visited
0 BUILD files updated
```

5.5.2 output has some new spam as well:

```
$ bazel configure
Updating BUILD files for protobuf, go, javascript
WARN[0000] Failed to load base tsconfig file @sourcegraph/tsconfig: open /Users/greg/aspect/sourcegraph/sourcegraph/@sourcegraph/tsconfig: no such file or directory 
Failed to parse tsconfig file client/completions-review-tool/tsconfig.json: ERR: position:298 object key must be string pos:298 : 
client/web/src/globals.d.ts:
	     17: }
         ^

client/web/src/storm/backend/route-loader.ts:
	     41:     usePreloadedQueryData: () => ReturnType<typeof useSuspenseQuery<D, V>>
                                                    ^
	     41:     usePreloadedQueryData: () => ReturnType<typeof useSuspenseQuery<D, V>>
                                                     ^

934 BUILD files visited
0 BUILD files updated
```
2023-06-22 18:33:15 +02:00
Tom Ross
9794790307
Cody Context: Better usage of editor selection and UI update (#53742) 2023-06-20 16:54:42 +01:00
Tim Lucas
66ff3a5eed
More compact Cody Chat Suggestions buttons (#53755)
This makes the suggestion buttons a little more compact for now (saves
50px vertical height on average)

| Before | After |
| - | - |
| <img width="322" alt="Screenshot 2023-06-20 at 10 46 07 pm"
src="https://github.com/sourcegraph/sourcegraph/assets/153/65df0187-366b-429b-8ff2-7571a4040f61">
|<img width="322" alt="Screenshot 2023-06-20 at 10 46 57 pm"
src="https://github.com/sourcegraph/sourcegraph/assets/153/15f88959-a2c6-492f-9325-d72e04ddd66a">
|

## Test plan

- Make the buttons appear
- Interact with them
2023-06-20 13:16:58 +00:00
Beatrix
4fc988f573
cody: add padding for stop-generating btn (#53751) 2023-06-20 12:34:29 +00:00
Deepak Kumar
1955d0eb47
Cody: Filter duplicate context files (#53662)
This PR closes #53652.


## Test plan

I tested it manually, and it shows the correct response without any
duplicates.
Attached screenshot of the results:

Before:
![iScreen Shoter - Code -
230619154919](https://github.com/sourcegraph/sourcegraph/assets/44617923/50b62e78-9a7d-48a0-ada1-30348f52e8f7)

After:
![iScreen Shoter - Code -
230619154941](https://github.com/sourcegraph/sourcegraph/assets/44617923/06aecd76-b464-40e5-94bb-a1cc1978e15d)

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2023-06-20 13:11:53 +02:00
Beatrix
44d483d43f
cody: fix context files overflow (#53726) 2023-06-20 16:37:19 +10:00
Beatrix
4201c7e96b
cody: update chat ui with stop generating button (#53332) 2023-06-19 08:19:01 -07:00
Erik Seliger
da262c68b6
Add enterprise UIs for cody enablement (#53360)
This PR implements
https://www.figma.com/file/ZpFPw0zZhVkCjrp68hPmA6/Enterprise-Cody-web-onboarding?type=design&node-id=0-1&t=sHIWi49gJ0ionqkp-0
for Cody enablement and simplifies the feature flags used to determine
when which of these should show. We now simply look at if cody is
enabled instead of multiple feature flags.

Closes https://github.com/sourcegraph/sourcegraph/issues/53023

Closes https://github.com/sourcegraph/sourcegraph/issues/52546

## Test plan

Manually verified.

---------

Co-authored-by: Rob Rhyne <rob@sourcegraph.com>
2023-06-16 03:35:58 +02:00
Philipp Spiess
16be058389
Cody: Add status bar item (#53307)
Closes #52597

This PR adds a new status bar item for Cody that we can use as a global
loading indicator (helpful for completions) and an easy way to
enable/disable features. More features coming soon!

As a follow-up we should make sure that all of these three features can
be turned on/off without having to reload the editor cc @abeatrix
@lrhacker

## Test plan


https://github.com/sourcegraph/sourcegraph/assets/458591/ab2b5a5e-6b38-4010-92f1-1796ef0a3c10


<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

---------

Co-authored-by: Tom Ross <tomross8@googlemail.com>
Co-authored-by: Beatrix <68532117+abeatrix@users.noreply.github.com>
Co-authored-by: Tim Lucas <t@toolmantim.com>
2023-06-14 12:19:18 +02:00
Naman Kumar
6b6008e55c
Add stop generating button to cody web (#53191)
Add stop generating button for in progress message for cody in web.
<img width="760" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/22571395/8ea16443-a125-4a73-8859-eb815cdd89e3">


https://www.loom.com/share/811352d2fb6942ff9851c9dedda281e1
## Test plan

- visit /cody
- ask a question
- click on stop generating button
- reload the page
2023-06-13 21:39:10 +00:00
Deepak Kumar
b17c0d6c2c
Cody: Improve chat history (#52904)
This PR closes #52544,  #52848, #52889 and #52890.

The issues mostly overlapped, so I handled it in this PR.

Changes made:
1. Add history to the history list on each new conversation started.
2. Display the last human message in history instead of the assistant
message.
3. Add a delete button to delete individual chats from history.
4. Load the most recent chat, if available, from the history.
5. Fix the loading of context files.
6. Load the history messages to the end of the scroll position.

## Test plan

All E2E tests have passed.
https://www.loom.com/share/3dca98dd0db94c298df38ab79c5e72d1

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2023-06-12 13:13:23 +02:00
Naman Kumar
5542e02dd1
Add multi-repo context selector to Cody Web (#53046)
- 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
2023-06-08 01:31:05 +05:30
Greg Magolan
b398952eca
Revert "revert "bazel: improve ESLint rule" (#52853)" (#52878)
- Revert "revert "bazel: improve ESLint rule" (#52853)"
- bazel: fix eslint custom rule so js_binary runfiles are included as
tool inputs to ctx.actions.run_shell

## Test plan

Tested locally that fix commit resolves the
```
FATAL: aspect_rules_js[js_test]: RUNFILES environment variable is not set
```
flaky issue that prompted the revert
2023-06-04 19:06:39 -07:00
Tim Lucas
7ae748a551
Remove "Generate Index" on hover for missing embeddings (#52736)
The "Generate Index" button is a bit misleading for dot com users, and
for people who aren't site admins (as per discussion in #52206) so this
just keeps it static as "Not Indexed". It also now just uses the
standard link colours.

Before:


https://github.com/sourcegraph/sourcegraph/assets/153/d36e7922-b026-4094-b0bd-8e4401d30182

After:


https://github.com/sourcegraph/sourcegraph/assets/153/3c8882b3-f5f5-4aed-a1fb-ebdcf810d755

## Test plan

- Tested locally

---------

Co-authored-by: Beatrix <68532117+abeatrix@users.noreply.github.com>
2023-06-03 17:36:28 +10:00
Valery Bugakov
e4b4c631cf
revert "bazel: improve ESLint rule" (#52853)
This reverts commit ff3ce9fe93 because of
the flaky errors on `main`. See [this Slack
thread](https://sourcegraph.slack.com/archives/C02FLQDD3TQ/p1685697360822839?thread_ts=1685696480.396849&cid=C02FLQDD3TQ).
2023-06-02 13:29:06 +00:00
Valery Bugakov
ff3ce9fe93
bazel: improve ESLint rule and disable ESLint outside of Bazel (#52667)
- Custom ESLint Bazel rule now relies on `sh_test`. The build part of
the rule produces the output file with ESLint errors, and the `sh_test`
target verifies that it's empty. If it's not empty, the ESLint test
fails, and the report content is printed to stdout.
- Added additional ESLint targets to `*.js` files in the root of each
client package.
- Added additional ESLint targets for `*.story.tsx` files for client
packages with stories. It's temporary until we start building Storybook
story modules with `ts_project`.
- Disabled ESLint outside of Bazel: **10-12m job is gone!** 🎉

## Test plan

bazel test `bazel query 'attr("name", ".*_eslint$", //client/...)'`
2023-06-02 08:37:40 +00:00
Beatrix
3218f7d9d8
Cody: Add docs on generate index (#52206) 2023-06-01 18:49:56 +00:00
Naman Kumar
e49ff43d6f
Re-write Cody Web Client (#52498)
Sorry for the big PR, but there was no other way. 

This PR almost entirely re-writes the Cody web client and state
management. The old state management was powered by zustand and not
native react states. It then internally integrated the chat client,
which was non-reactive. The old chat client was just builder function,
and it was required to re-create the client with every single change.
The old client then also used callbacks to update the state at the
parent level, and the state was partially duplicated. Basically, it
needed a makeover.

- The new client is reactive and uses native react states.
- The new chat store allows having separate chat states for the sidebar
and standalone chat.
- The states are not partially duplicated at two places anymore.
- It also prepares for multi-repo scope.
- It introduces URL-based routing for /chat.
- It disables the editor widget when a message is in progress.
- It also prepares for editing any message and not just the last one.
- It also fixes the re-rendering of the whole chat on input change.

Future PRs:
- update Codebase context and context fetcher clients to support new
CodyClientScope aka multi-repo context
- implement cody scope selector UI
- save the scope with each interaction and the current scope with the
transcript.
- load the current scope from the transcript on load.
- show scope with each human message.
- show scope selector with edit message form.
- Allow editing of any message and not just the last.

## Test plan

- visit /cody on web and check if messages, history and all other
actions are working as expected.
- Check same for vs code & app.
2023-05-31 01:53:54 +05:30
Beatrix
0e15c43381
Cody: Insert code block at cursor position (#52528) 2023-05-30 08:59:51 -07:00
Valery Bugakov
760db946dd
bazel: implement custom ESLint Bazel rule (#52062)
- Upgraded `aspect_bazel_lib`, `aspect_rules_js` and `aspect_rules_ts`
to the latest versions.
- Ran [bazel run
//.aspect/bazelrc:update_aspect_bazelrc_presets](40a7422385)
- Added `eslint_config` macro for client package eslint configuration
`js_library` targets.
- Implemented the custom ESLint rule, which copies `srcs` with
dependencies and **declarations** to the Bazel to lint them. This way,
we maintain the ability to do type-aware linting in Bazel.
- Added a custom ESLint formatter used in Bazel to print out relative
paths in ESLint reports.

In the follow-up PR, I will look into improvements suggested by
@alexeagle that should allow us to convert ESLint build targets into
test targets and gracefully manage linting failures.

## Test plan

1. CI
2. `bazel build $(bazel query 'kind("_eslint_test_with_types",
//client/...)')`
2023-05-22 04:05:45 -07:00
Naman Kumar
fbe9f63296
Add Cody verify your email popup and notice for dotcom (#52165)
Add alerts, notices, popups dotcom for restricting Cody access to
logged-in users with verified emails only.


https://www.loom.com/share/865d8621dbd440a3ae926a647ce4adca

design:
https://www.figma.com/file/DIk3eGdgKszigQVec7Y8SD/Frictionless-cody?type=design&node-id=767-30229&t=ee1VyzmpjtZhgrNq-0

## Test plan

- sign up with a new account
2023-05-19 15:53:56 +05:30
Beatrix
476ace5fb1
Cody: Minior clean ups and papercut fixs (#51883) 2023-05-16 16:02:10 +00:00
Naman Kumar
a2c340892a
Add repo and revision info to contextFiles (#51877)
Add repoName, revision info to contextFiles to render links on web.

<img width="1314" alt="image"
src="https://github.com/sourcegraph/sourcegraph/assets/22571395/a2153cb0-d77d-4ea3-953b-490abe1d8d50">


## Test plan

- visit /cody
2023-05-16 15:50:25 +05:30
Auguste Rame
04ff23ba20
Improve / fix arrow keys for Cody history (#51586)
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.
2023-05-15 12:59:26 -04:00
Quinn Slack
331c4c9866
go back to just showing a blinking cursor in Cody when loading (#51015)
No more "Fetching context" text, which just adds noise IMO.

[Slack
thread](https://sourcegraph.slack.com/archives/C052G9Y5Y8H/p1682136846050229):
As a user I don’t like the Fetching context or Working on it
(https://github.com/sourcegraph/sourcegraph/pull/50969/files#r1174224321)
text displaying. It just adds noise. Maybe we could show something if
it’s taking a long time, and we should show errors, but otherwise, I’m
just like “I get it, it is thinking and blinking, I don’t need to see
other text”. Anyone else agree?



## Test plan

n/a

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2023-05-15 17:27:26 +02:00
Auguste Rame
3040490f6a
Cody: Add submit button to edit dialog for parity with chat input box (#51900)
Closes #51740

## Test plan

Tested web and VSCode locally.
2023-05-15 10:33:08 -04:00
Naman Kumar
5eeb2102b0
Improve Cody Web Chat UI (#51614)
Fix a bunch of things in Cody Web UI:
1. Input box overlaps the last chat message.
2. `<code>` in message overflows.
3. Switching to the old chat doesn't scroll down to the latest message.

## Test plan

- visit cody web chat
2023-05-09 14:10:14 +05:30
Tim Lucas
a822820b48
Add the cody-icons font (#51559)
This adds the icon font used in the Cody VS Code Figma, so we can start to use the icons in the VS Code extension.

## Test plan

None required
2023-05-08 02:30:37 +00:00
Valery Bugakov
d536cd024d
bazel: disable build-ts and build client/cody with Bazel (#51404)
- Typescript in all client packages is now built with Bazel
- Disabled the `build-ts` job on CI
2023-05-05 03:57:10 -07:00
Philipp Spiess
b01eb60174
Cody: Log chat prediction usage (#51474)
Adds logging to the chat prediction experimental feature.

## Test plan


https://user-images.githubusercontent.com/458591/236258186-697fcbfb-1ce8-45dd-8703-86a1e7b8dbee.mov



<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
2023-05-04 18:28:34 +02:00
Daniel Marques
3ee30bb29c
Improved Cody header logo and layout details (#51348)
Adds style fixes to the header of cody.


![pr_cody](https://user-images.githubusercontent.com/7814431/235649828-269f108f-ef4c-449a-84af-9a1f5f880f8e.png)



**Changes:**

- Replaces logo with new version with better kerning and spacings (thx
@toolmantim)
- Adds a muted Sourcegraph logo in order to keep our brand present
- Tones down "experimental badge"
- Aligns the header with the title bar of the sidebar (now uses 20px
padding, what the title bar also uses)

## Test plan

Tested different color schemes and themes, seems to be somewhat
consistent no matter the theme chosen by the user.

<img width="609" alt="Screenshot 2023-05-02 at 12 04 58"
src="https://user-images.githubusercontent.com/7814431/235650023-d1d608fa-a2a9-45ca-9f8a-57e8f91fa1c8.png">

<img width="565" alt="Screenshot 2023-05-02 at 12 05 09"
src="https://user-images.githubusercontent.com/7814431/235650090-920aa54a-0d45-4b6a-952e-6e245e95c74b.png">

Some issues with the SG logo in more aggressive Themes, but the Cody
logo works in any theme it seems

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

---------

Co-authored-by: Tim Lucas <t@toolmantim.com>
Co-authored-by: Beatrix <beatrix@sourcegraph.com>
2023-05-04 14:21:08 +01:00
Philipp Spiess
fb61a539c3
Cody: Suggest follow-up topics (#51201)
This adds a new recipe that is used to suggest up to three follow-up
topics for Cody. The recipe is executed with every user chat message but
will not wait for the answer so that the experience is better (this is
in line with comparable chat bots).

## ToDo

- [x] Add behind a feature flag for now 

## Test plan



https://user-images.githubusercontent.com/458591/234884949-cd71893a-ee12-408f-8d7f-b6ca76497b66.mov



<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
2023-04-27 16:02:51 +00:00
Philipp Spiess
21b8501f7a
Cody: Alternative implementation for markdown escaping (#51151)
This replaces #51144

The previous implementation was limiting in various factors:

- The `sanitze` option of the Markdown library is deprecated since
forever. It actually logged a bunch of nasty warnings to the console.
The recommended way to deal with escaping is by using a library (like
`DOMPurify` in our case) _after_ the markdown step.
  
We already do the above, hooray! This means that in no point in time did
we ever had a XSS vulnerability but only a style related issue.

The problem is that sometimes Cody emits HTML outside of code blocks and
any visual HTML is allowed by our current `DOMPurify` config. We could
change this, but then we would have to maintain a complicated allowlist
for all HTML tags generated in the markdown transformation and all
compliant tags are removed. In addition to that, Cody could still emit
these HTML events outside of code blocks. E.g. use this prompt "Write
some HTML but don't use Markdown to format it". The rule of thumb here
is that anything from cody should be relayed to the user 1:1, so we can
neither remove nor "render" some tags (even if they are just empty
`<div>` that do nothing). When Cody returns `<div>I’m a banana</div>` we
want to surface the `<div>` string to the user.
- We have to support two use cases where we insert HTML into the message
deliberately (and we will have more of these as we add more code intel
goodies): Error messages and hallucination detection. I wanted to keep
these abstractions similar to where they are though, as anything more
complicated would require bigger restructurings.

Because of this, I came up with a different implementation: We have two
clear boundaries of where these messages come from: Either form the Cody
API endpoint _or_ from the user input (because similarly, if a user
types `<div>I’m a banana</div>` into the input box and presses enter, it
would be strange if only `I’m a banana` shows up in the prompt.).

At these distinct places, we now call `escapeCodyMarkdown` which will
replace `<` and `>` to `&lt;` and `&gt;` respectively (as long as the
content is outside of a code block where we just leave it as-is.

Remember: This is not a security related XSS prevention. We already do
that because the output from the markdown parser is being escaped but
`DOMPurify`. The goal here is just to preserve HTML tags in the prompt
and relay them to the end user.

## ToDo

- [ ] Apply the same fix to the web client 

## Test plan

<img width="587" alt="Screenshot 2023-04-26 at 14 27 41"
src="https://user-images.githubusercontent.com/458591/234578592-dfb1ff15-53b2-4b9b-b342-6e9dfeb55206.png">
<img width="619" alt="Screenshot 2023-04-26 at 14 17 13"
src="https://user-images.githubusercontent.com/458591/234578597-9dc23401-62ac-43ca-b273-632c6fb9b2cf.png">


<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

---------

Co-authored-by: David Veszelovszki <veszelovszki@gmail.com>
2023-04-26 18:16:35 +02:00
Naman Kumar
955c25e37e
Fix Transcript UI (#51136) 2023-04-26 17:49:39 +05:30
Philipp Spiess
fea2903ec3
Cody: Escape generated HTML (#51144)
Closes #50680

I'm not sure how much we trust Cody but that was a bit too much for my
taste 🙈

I did not get it to execute JS though (that luckily seems disabled by
default when using `innerHTML`) -- That doesn't mean that it's not
possible though, maybe some combination of `<img onload="">` would still
fire, not 100% sure. Let's do a release after this is merged and when we
have freed `main` from the current hiccups.

## Test plan

<img width="1092" alt="Screenshot 2023-04-26 at 11 09 57"
src="https://user-images.githubusercontent.com/458591/234528256-e1563a63-d81e-4e99-b88e-b82e66250ba0.png">
<img width="629" alt="Screenshot 2023-04-26 at 11 07 25"
src="https://user-images.githubusercontent.com/458591/234528268-d6387235-006c-4f04-a660-9786a4d3d1da.png">

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
2023-04-26 11:47:12 +02:00
Aditya Kalia
dfba9c0446
Cody: add logging to copy button (#51011) 2023-04-25 17:26:53 -05:00
Naman Kumar
80f7910f62
Add cody web history ui (#51072)
Added UI for Cody web chat history. 

Demo: https://www.loom.com/share/1423f730385a4a189dc4fddcce96b452


## Test plan

- Open Ask Cody and visit history section.
2023-04-25 20:32:41 +05:30
Philipp Spiess
fed54b854e
Cody Web: Fix no embeddings use case (#51082)
Reported here:
https://github.com/sourcegraph/sourcegraph/pull/51072#issuecomment-1521295540

Right now, Cody web simply crashes when encountering a repo that has no
embeddings. This is because it falls back to the keyword based
implementation which throws on the web (we won't have it there for a
while, because the vs code extension uses a native library to implement
that).

Since Cody is now useful even for unindexed repos (because we add the
currently viewed file into the context automatically), I think making it
gracefully handle this situation is better than disabling Cody for these
views.

## Test plan

<img width="593" alt="Screenshot 2023-04-25 at 12 15 13"
src="https://user-images.githubusercontent.com/458591/234247521-281859da-4c34-4c2c-b451-f355d0e7e2f7.png">


<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->
2023-04-25 15:36:34 +02:00
Auguste Rame
0c3a030f71
Add functionality for editing Cody messages (#51009)
Closes #50974
## Test plan

Tested locally in VSCode and it *seems* to work - feel free to suggest
additional testing methodologies :)

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2023-04-25 10:50:24 +02:00
Beatrix
fd599d7606
cody: add height to chat header (#51013)
Minor fix

Issue: because there is no fixed height for the chat message header,
there will be a twitch at the end once cody's response is completed
because of the feedback buttons attached at the end that changes the
height:

![header](https://user-images.githubusercontent.com/68532117/233753896-317f104b-ae4a-48b9-982e-09538c8f5d11.gif)

Solution: adding fixed height to the header container so that the height
will remain the same at all the time

## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

styling changes tested locally.
2023-04-24 07:37:15 -07:00
Beatrix
df999af89a
Cody: Fallback to keyword context for invalid embeddings client (#50952)
RE: https://github.com/sourcegraph/sourcegraph/issues/50876 

This PR addresses the issues raised by a customer and beyang ([slack
thread](https://sourcegraph.slack.com/archives/C04NPH6SZMW/p1681861031576389?thread_ts=1681859730.152309&channel=C04NPH6SZMW&message_ts=1681861031.576389))
regarding cody.codebase:
1. make it visible to the user what context mechanism is being used
1. we should fall back to keyword search if embeddings don't work
1. also lack of embeddings should surface a user-visible error

### PR Summary

#### Issue 1: make it visible to the user what context mechanism is
being used

Solution from this PR: Show the current fetching method in the lower
left corner

![Screenshot 2023-04-20 at 3 43 34
PM](https://user-images.githubusercontent.com/68532117/233503321-706393a7-ba5c-43ae-93b4-54ae09485c91.png)

![Screenshot 2023-04-20 at 3 44 56
PM](https://user-images.githubusercontent.com/68532117/233503446-e593b685-62fd-49cf-a847-0187936df0b7.png)

#### Issue 2: fall back to keyword search when embedding is not
available

Solution from this PR: Fallback to keyword search when:
- codebase is not provided
- embeddings are not available for the current codebase

When codebase is not provided and the cody.useContext is set to
'embedding' or 'blended', we will now fallback to use keyword search
(see context fetching mode in lower left corner)
![Screenshot 2023-04-20 at 3 45 32
PM](https://user-images.githubusercontent.com/68532117/233503939-0e653a48-5322-4ae0-bbcc-315daa46911b.png)

When code is provided but Cody is unable to connect to the codebase, we
will now fallback to use keyword search (see context fetching mode in
lower left corner)
![Screenshot 2023-04-20 at 3 44 56
PM](https://user-images.githubusercontent.com/68532117/233503446-e593b685-62fd-49cf-a847-0187936df0b7.png)

#### Issue 4:  lack of embeddings should surface a user-visible error

Solution from this PR: display message on codebase change / invalid
codebase in UI (see screenshots above)

When the cody.codebase is change, a pop up will also show up and ask
user to reload VS Code (see lower right corner):
![Screenshot 2023-04-20 at 3 44 15
PM](https://user-images.githubusercontent.com/68532117/233504281-6fd7e0fb-c4ff-4ad9-b82f-5441661d07a1.png)

#### other minor fix

- Disable chat submission on enter key press when chat is in progress

## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->

See screenshot shared above. Passed all unit test

```
 PASS   cody  src/configuration.test.ts
 PASS   cody  src/completions/context.test.ts
 PASS   cody  src/keyword-context/local-keyword-context-fetcher.test.ts

Test Suites: 3 passed, 3 total
Tests:       5 passed, 5 total
Snapshots:   0 total
Time:        2.127 s
Ran all test suites.
```

---------

Co-authored-by: Philipp Spiess <hello@philippspiess.com>
2023-04-21 18:25:48 +00:00
Beatrix
5272c8d6d0
Cody: add and log feedback (#50875) 2023-04-20 04:40:04 -07:00