Commit Graph

16603 Commits

Author SHA1 Message Date
Piotr Osiewicz
f3abb7e724 assistant: Grab focus when clicking on history icon 2024-08-08 13:18:31 +02:00
Bennet Bo Fenner
389cb86e43
assistant: Dismiss model selector after changing model (#15974)
Co-Authored-By: Thorsten <thorsten@zed.dev>

Release Notes:

- N/A

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-08 13:09:03 +02:00
Bennet Bo Fenner
fea8f16df0
assistant: Show regenerate button only on hover (#15972)
https://github.com/user-attachments/assets/92006a45-5b4e-4ec4-a056-9ef7dd76394d



Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-08 13:08:57 +02:00
Danilo Leal
76d58ac295
Add design tweaks to the AI configuration panel (#15894)
This PR polishes elements around setting up LLM providers on the
Assistant panel, including:

- [x] Adding banners for promoting Zed AI and to deal with the "No
provider set up" scenario
- [x] Tweaking the error popover whenever there's no API key added
- [ ] Making configuration panel scrollable

--- 

Release Notes:

- N/A

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2024-08-08 12:12:36 +02:00
Bennet Bo Fenner
e69b0833aa
markdown preview: Detect language of buffer correctly (#15961)
Fixes #15958

Release Notes:

- Fixed an issue where the markdown preview button would not show up for
some markdown files
([#15958](https://github.com/zed-industries/zed/issues/15958)).
2024-08-08 11:53:37 +02:00
Nathan Sobo
da8d1306af
Open workflow step editors as preview tabs (#15928)
This PR opens workflow step editors as preview tabs and closes them upon
exiting the step if they are still in preview mode and they weren't
already open before entering the step.

Making this work was tricky, because we often edit the buffer as part of
displaying the workflow step suggestions to create empty lines where we
can generate. We undo these edits if the transformation is not applied,
but they were causing the preview to be dismissed.

After trying a few approaches, I decided to give workspace `Item`s a
`preserve_preview` method that defaults to false. When the workspace
sees an edit event for the item, it checks if the item wants to preserve
its preview. For buffers, after editing, you can call `refresh_preview`,
which sets a preview version to the current version of the buffer. Any
edits after this version will cause preview to not be preserved.

One final issue is with async auto-indent. To ensure these async edits
don't dismiss the preview, I automatically refresh the preview version
if preview was preserved prior to performing the auto-indent. The
assumption is that these are edits created by other edits, and if we
didn't want to dismiss the preview with the originating edits, then the
auto-indent edits shouldn't dismiss it either.

Release Notes:

- N/A

---------

Co-authored-by: Jason <jason@zed.dev>
2024-08-07 19:33:58 -06:00
Marshall Bowers
6f6eeb6595
collab: Update how mode is displayed in root endpoint (#15911)
This PR adjusts how we display the "mode" collab is running in on the
root endpoint.

It's minor, but it does make things a bit cleaner.

Release Notes:

- N/A
2024-08-07 12:09:43 -04:00
Joseph T Lyons
22162e884b v0.149.x dev 2024-08-07 10:59:51 -04:00
Bennet Bo Fenner
3a52d6cc52
assistant: Limit model access for Zed AI users to Claude-3.5-sonnet (#15904)
This prevents users from accessing other models, such as OpenAI's GPT-4
or Google's Gemini-Pro.
Staff members can still access all models.

Co-authored-by: Thorsten <thorsten@zed.dev>

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-07 16:26:56 +02:00
Bennet Bo Fenner
efbf7ada28
settings: Show error notification when settings are invalid (#15905)
https://github.com/user-attachments/assets/07627142-e730-4446-a50b-7ef46f8e661c

We want to improve the design in the future, but it fixes a long
standing paper cut for now.

Release Notes:

- Added a popup that is displayed when the settings are invalid

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-07 15:54:44 +02:00
Thorsten Ball
94028290cc
assistant panel: Use feature flag for Zed Pro mentions (#15903)
This removes Zed Pro mentions.

Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-07 14:44:00 +02:00
Son
f24f601e05
Adjust erf estimation function (#15423)
Release Notes:

- Fixed a (potential) small error in erf estimation. Technically, the
error is negligible.

I am not sure where the current calculation for erf come from and if it
is intended or a simple mistake. However it looks slightly different
from the official calculation, notably
[this](https://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions)
from Wikipedia.

I will add a comment if it is intended.
2024-08-07 14:12:26 +02:00
Piotr Osiewicz
2db2b636f2
assistant: Add annotations to more languages (#15866)
Release Notes:

- N/A
2024-08-07 13:47:21 +02:00
Piotr Osiewicz
8aa1ba8cbc
assistant: Tweak tab bar layout (#15901)
- Add "New Context" button next to the hamburger
- Add "History"
- Allow Pane tab rendering callback to return items for both left and
right side of the tab bar.


![image](https://github.com/user-attachments/assets/d5aa599d-c9e4-4f26-ad66-ffc290c53c29)


Release Notes:

- N/A
2024-08-07 13:46:59 +02:00
Piotr Osiewicz
bf403ca788
chore: Remove assistant labels for users without feature flag enabled (#15899)
Release Notes:

- N/A
2024-08-07 12:46:49 +02:00
Nathan Sobo
990774247e
Allow /workflow and step resolution prompts to be overridden (#15892)
This will help us as we hit issues with the /workflow and step
resolution. We can override the baked-in prompts and make tweaks, then
import our refinements back into the source tree when we're ready.

Release Notes:

- N/A
2024-08-06 21:47:42 -06:00
Nathan Sobo
c8f1358629
Allow prompt templates to be overridden in the zed configuration directory (#15887)
I need this to refine our prompts on the fly as I work.

Release Notes:

- Templates for prompts driving inline transformation in editors and the
terminal can now be overridden in the `~/.config/zed/prompts/templates`
directory. This is an advanced feature, and prevents you from getting
upstream changes. It's intended for use by Zed developers.
2024-08-06 19:30:48 -06:00
Kyle Kelley
6065db174a
repl: Improve kernelspec discoverability (#15886)
<img width="862" alt="image"
src="https://github.com/user-attachments/assets/ae8c479d-d9f9-4c46-bb1a-be411ab07876">

Release Notes:

- Added additional context about available to kernel sessions
- Fixed bug in kernelspec launch choosing first available kernel
matching the language rather than selected name

---------

Co-authored-by: Jason <jason@zed.dev>
2024-08-06 16:58:56 -07:00
Marshall Bowers
a54e16b7ea
collab: Add usages table to LLM database (#15884)
This PR adds a `usages` table to the LLM database.

We'll use this to track usage for rate-limiting purposes.

Release Notes:

- N/A
2024-08-06 18:40:10 -04:00
Marshall Bowers
b19f85f9b5
collab: Remove unused parameter to run_database_migrations (#15883)
This PR removes the unused `ignore_checksum_mismatch` parameter to
`run_database_migrations`.

We were always passing `false`, which meant the behavior didn't need to
be parameterized.

Release Notes:

- N/A
2024-08-06 17:31:52 -04:00
Marshall Bowers
7f6d0919c9
collab: Setup database for LLM service (#15882)
This PR puts the initial infrastructure for the LLM service's database
in place.

The LLM service will be using a separate Postgres database, with its own
set of migrations.

Currently we only connect to the database in development, as we don't
yet have the database setup for the staging/production environments.

Release Notes:

- N/A
2024-08-06 17:18:08 -04:00
Joseph T. Lyons
a64906779b
Use vanity Discord link (#15880)
Release Notes:

- N/A
2024-08-06 16:55:51 -04:00
Joseph T. Lyons
11c6ada08f
Add tooltip for toggling filters (#15879)
Release Notes:

- N/A
2024-08-06 15:51:53 -04:00
Antonio Scandurra
104d7adc49
Don't insert unnecessary space below the end of an inline transformation (#15865)
We achieved this by allowing block decorations to have a height of `0`
and superimposing the border on top of the line, as opposed to carving
out space below it.

Release Notes:

- N/A

---------

Co-authored-by: Jason <jason@zed.dev>
2024-08-06 19:00:23 +02:00
Bennet Bo Fenner
2e27448d5f
assistant: Fix inline assistant not working for non-terminal panel views (#15864)
Fixes #15729

Release Notes:

- Fixed an issue where the terminal inline assistant would not appear
when opening a terminal in the center pane
([#15729](https://github.com/zed-industries/zed/issues/15729)).
2024-08-06 18:41:54 +02:00
Max Brunsfeld
33afbe9a94
Add LLM service to kubernetes deployment action (#15863)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-06 12:35:00 -04:00
Marshall Bowers
cf5f4dddf5
Authorize access to language model providers based on country (#15859)
This PR updates the LLM service to authorize access to language model
providers based on the requester's country.

We detect the country using Cloudflare's
[`CF-IPCountry`](https://developers.cloudflare.com/fundamentals/reference/http-request-headers/#cf-ipcountry)
header.

The country code is then checked against the list of supported countries
for the given LLM provider. Countries that are not supported will
receive an `HTTP 451: Unavailable For Legal Reasons` response.

Release Notes:

- N/A
2024-08-06 11:49:04 -04:00
Antonio Scandurra
9c6ccaffe3
Allow user to restart transformation after stopping without a diff (#15858)
Release Notes:

- N/A

Co-authored-by: Jason <jason@zed.dev>
2024-08-06 17:25:13 +02:00
Antonio Scandurra
411934bb61
Introduce a new /workflow command (#15854)
This subsumes the previous built-in prompt.

Release Notes:

- N/A
2024-08-06 16:18:07 +02:00
Piotr Osiewicz
874f0c0712
assistant: Use tools in other providers (#15803)
- [x] OpenAI
- [ ] ~Google~ Moved into a separate branch at:
https://github.com/zed-industries/zed/tree/tool-calls-in-google-ai I've
ran into issues with having the API digest our schema without tripping
over itself - the function call parameters are malformed and whatnot. We
can resume from that branch if needed.
- [x] Ollama
- [x] Cloud
- [ ] ~Copilot Chat (?)~

Release Notes:

- Added tool calling capabilities to OpenAI and Ollama models.
2024-08-06 15:45:47 +02:00
Kirill Bulatov
be514f23e1
Improve streaming git diffs to be less jumpy during inline assistant generation (#15853)
Release Notes:

- Improved streaming git diffs to be less jumpy during inline assistant
generation

---------

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2024-08-06 16:13:29 +03:00
Marshall Bowers
82310092a2
inline_completion_button: Do some cleanup (#15849)
This PR does some cleanup in the `inline_completion_button` after
#15443.

Release Notes:

- N/A
2024-08-06 08:55:27 -04:00
Kevin Wang
7cef5b2956
Add menu item to switch Supermaven and Copilot (#15443)
Adds a "Use Supermaven" and "Use Copilot" menu item to the signed out
menus for each of the autocomplete providers to make it easier to switch
between them without having to update your local settings json.

<img width="222" alt="image"
src="https://github.com/user-attachments/assets/6f760f4e-5527-4971-bdaf-383bc99649bd">

Release Notes:

- Added menu items to quickly switch between Supermaven and Copilot
inline completions when the provider is not configured
2024-08-06 13:54:30 +02:00
Konstantin Matsiushonak
f4a58e5411
typescript: Make it possible to use local vtsls (#15775)
Related things:
https://github.com/zed-industries/zed/issues/7902
https://github.com/zed-industries/zed/issues/4978

Release Notes:
- Added: positibily to use locally installed vtsls
2024-08-06 12:37:13 +02:00
Bennet Bo Fenner
d6e5265e84
assistant: Limit model access (#15820)
Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-06 12:19:19 +02:00
Bennet Bo Fenner
56abd68d0e
assistant: Cleanup model selector (#15843)
We changed the following for the model selector:
- Fixed displaying checkmarks for selected models when using models with
the same name from different providers
- We now show the icon for the active model instead of displaying the
provider name in the trigger of the model selector
- Only display the footer when the language models feature flag is zed,
so that we don't release the hint for Zed Pro to preview tomorrow

<img width="253" alt="image"
src="https://github.com/user-attachments/assets/f95ccfb6-c0cf-43d4-9637-e2823100a427">


Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-06 11:59:54 +02:00
Jaakko Sirén
fb1cd7cae2
blade: Update to pick up Intel memory coherency fix & fix calling blade params (#15829)
Builds on @kvark's PR https://github.com/zed-industries/zed/pull/15781
by fixing call to Blades `create_texture_view` the arguments of which
had changed.


Picks up https://github.com/kvark/blade/pull/153

Release Notes:

- Fixed Zed flickering on Linux when using Intel graphics.
([#14101](https://github.com/zed-industries/zed/issues/14101)).

---------

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-08-06 11:33:18 +02:00
Antonio Scandurra
44ae9efb27
Cancel workflow step automatically when moving outside <step> tag (#15842)
Also, open edit suggestions automatically as soon as the edit step is
resolved.

Release Notes:

- N/A
2024-08-06 11:30:09 +02:00
Luis Cossío
7b5fdcee7f
lsp: Support Goto Declaration (#15785)
Adds support for [Goto
Declaration](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_declaration)
LSP command.

I am particularly interested in [this for Rust
projects](https://rust-analyzer.github.io/manual.html#go-to-declaration),
to be able to navigate to the place where a trait method is declared,
coming from a trait method implementation.

I noticed this was something I could do in VSCode before, but was
somehow missing is Zed. Thanks to the already existing infrastructure
for Goto Definition, I just followed and copy-paste-adapted it for Goto
Declaration.

As a bonus, I added `ctrl-F12` and `alt-ctrl-F12` as default macOS
keybindings for `GoToDeclaration` and `GoToDeclarationSplit`,
respectively. They are not keybindings from another editor, but I
figured they made sense to be grouped along with the other *F12
commands.

### Release Notes:

- Added "Go to declaration" editor action.
- vim: Breaking change to keybindings after introduction of the `Go to
declaration` editor action. The new keybindings are the following (and
can be found [here](https://zed.dev/docs/vim), alongside the other key
bindings):
  - `g d` - Go to definition
  - `g D` - Go to declaration
  - `g y` - Go to type definition
  - `g I` - Go to implementation




https://github.com/user-attachments/assets/ee5c10a8-94f0-4e50-afbb-6f71db540c1b

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-08-06 11:20:51 +02:00
apricotbucket28
82db5dedfb
terminal: Fix context menu keybindings flicker (#15771)
Fixes https://github.com/zed-industries/zed/issues/15156


[Screencast_20240804_112659.webm](https://github.com/user-attachments/assets/d6d15e65-ece2-4342-b2ca-55e3737a4736)

Release Notes:

- N/A
2024-08-06 10:13:26 +02:00
Marshall Bowers
ca9511393b
collab: Add support for more providers to the LLM service (#15832)
This PR adds support for additional providers to the LLM service:

- OpenAI
- Google
- Custom Zed models (through Hugging Face)

Release Notes:

- N/A
2024-08-05 21:16:18 -04:00
Max Brunsfeld
8e9c2b1125
Introduce a separate backend service for LLM calls (#15831)
This PR introduces a separate backend service for making LLM calls.

It exposes an HTTP interface that can be called by Zed clients. To call
these endpoints, the client must provide a `Bearer` token. These tokens
are issued/refreshed by the collab service over RPC.

We're adding this in a backwards-compatible way. Right now the access
tokens can only be minted for Zed staff, and calling this separate LLM
service is behind the `llm-service` feature flag (which is not
automatically enabled for Zed staff).

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-05 20:26:21 -04:00
Marshall Bowers
4ed43e6e6f
collab: Ignore Stripe events that are older than an hour (#15830)
This PR makes it so any Stripe events we receive that occurred over an
hour ago are marked as processed.

We don't want to process an old event long after it occurred and
potentially overwrite more recent updates.

This also makes running collab locally a bit nicer, as we won't be
getting errors for a bunch of older events that will never get processed
successfully.

The period after time after which we consider an event "stale" can be
modified, as needed.

Release Notes:

- N/A
2024-08-05 17:15:38 -04:00
Kyle Kelley
f6a0fef5cf
repl: Address simple fixes (#15828)
Release Notes:

- Added logging in debug mode of raw kernel output from REPL.
- Fixed REPL kernels not being shut down completely on close of Editor
2024-08-05 13:48:15 -07:00
apricotbucket28
ab1fabef68
gpui: Align SVG sprites to whole pixels (#15822)
Related to https://github.com/zed-industries/zed/issues/12352 (and old
issue https://github.com/zed-industries/zed/issues/643)

This fixes visual glitches that could happen when rendering icons on
Linux and Windows (and in the Blade backend)


![image](https://github.com/user-attachments/assets/02646d1d-d35b-48be-89c9-189416510cf2)

![image](https://github.com/user-attachments/assets/ccf99867-25d2-40fb-8735-c540f8cf793a)

![image](https://github.com/user-attachments/assets/8d1124a3-669e-4be5-8b46-5dc2df14a28a)


Release Notes:

- Linux: Fixed visual glitches when rendering icons.
2024-08-05 12:43:23 -07:00
Max Brunsfeld
27779e33fb
Refactor: Restructure collab main function to prepare for new subcommand: serve llm (#15824)
This is just a refactor that we're landing ahead of any functional
changes to make sure we haven't broken anything.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Jason <jason@zed.dev>
2024-08-05 12:07:38 -07:00
Marshall Bowers
705f7e7a03
collab: Include geoip_country_code in initial span (#15819)
This PR changes how we report the `geoip_country_code` in the tracing
spans.

I wasn't seeing it come through in the logs, and I think it was because
we didn't declare the field on the initial span.

Release Notes:

- N/A
2024-08-05 12:24:47 -04:00
Marshall Bowers
04ad088eb8
assistant: Remove old model selector code (#15817)
This PR removes the old model selector code, as it was no longer used
after #15693.

Release Notes:

- N/A
2024-08-05 12:19:16 -04:00
Nate Butler
03cc18dd20
assistant-panel: Update model selector to a combo-box (#15693)
This updates the model selector to be a combobox (filterable list)

This PR causes the following regression: There is no longer a message in
the inline assistant explaining context is included from the assistant
panel. Will follow up with some sort of solution soon.

Before:
![CleanShot 2024-08-02 at 13 11
12@2x](https://github.com/user-attachments/assets/648ec4e3-48bc-4720-aaad-7659d848a4fa)

After:
![CleanShot 2024-08-02 at 13 10
37@2x](https://github.com/user-attachments/assets/09de098b-1a4a-44be-a6ae-6879f233d9a4)
![CleanShot 2024-08-02 at 13 10
48@2x](https://github.com/user-attachments/assets/701ce01c-3d6c-4c63-a6fc-53deff5d56c7)

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
2024-08-05 11:52:07 -04:00
Marshall Bowers
f11f3f2599
collab: Attach GeoIP country code to RPC sessions (#15814)
This PR updates collab to attach the user's GeoIP country code to their
RPC session.

We source the country code from the
[`CF-IPCountry`](https://developers.cloudflare.com/fundamentals/reference/http-request-headers/#cf-ipcountry)
header.

Release Notes:

- N/A
2024-08-05 11:11:49 -04:00