Commit Graph

16717 Commits

Author SHA1 Message Date
Kirill Bulatov
081cbcebd9
Merge /active command into /tabs one (#16154)
Now, tabs have arguments, `active` (default, applied also for no
arguments case) and `all` to insert the active tab only or all tabs.

Release Notes:

- N/A
2024-08-13 13:15:57 +03:00
Stanislav Alekseev
c2b254a67a
Fallback to using tree-sitter when determining ranges for info popovers (#16062)
Closes #15382

Release Notes:

- Added fallback to a smallest tree sitter node when hovering over a
symbol
2024-08-13 12:01:14 +02:00
Thorsten Ball
af36d4934c
assistant panel: Animate assistant label if message is pending (#16152)
This adds a pulsating effect to the assistant header in case the message
is pending.

The pulsating effect is capped between 0.2 and 1.0 and I tried (with the
help of Claude) to give it a "breathing" effect, since I found the
normal bounce a bit too much.

Also opted for setting the `alpha` on the `LabelLike` things, vs.
overwriting the color, since I think that's cleaner instead of exposing
the color and mutating that.


https://github.com/user-attachments/assets/4a94a1c5-8dc7-4c40-b30f-d92d112db7b5


Release Notes:

- N/A
2024-08-13 11:41:44 +02:00
Kirill Bulatov
b36d1386a9
Fix editor::Cancel action not inline assistant inputs created for empty selections (#16150)
Release Notes:

- N/A
2024-08-13 12:11:57 +03:00
Uladzislau Kaminski
ee6a40137f
Remove extra empty space for files when file icons are turned off (#16142)
Closes #16073

<img width="269" alt="image" src="https://github.com/user-attachments/assets/88b7ff9f-17ec-4764-b37a-c218d7ad14ec">

Release Notes:

- Removed extra empty space for files when file icons are turned off ([#16073](https://github.com/zed-industries/zed/issues/16073))
2024-08-13 12:09:13 +03:00
Nathan Sobo
1c189e82a0
Improve tooltip text (#16147)
![image](https://github.com/user-attachments/assets/90faf9ce-0515-4a99-92ca-c69b17b5149e)

Release Notes:

- Include a count of the context tokens when hovering token counts in
the inline assist.
2024-08-12 23:24:27 -06:00
Nathan Sobo
a515442a36
Rely on model to determine indentation level and always rewrite the full line (#16145)
This PR simplifies our approach to indentation in the inline assistant
in hopes of improving our experience for Python. We tell the model to
generate the correct indentation in the prompt, and always start
generating at the start of the line. This may fall down for less capable
models, but I want to get a solid experience on the best models and then
figure the rest out later.

Also: We now prefer `./assets/prompts` as an overrides directory when
stdout is a PTY, so you can do `cargo run` and then iterate prompts for
the current run inside the current working copy.

cc @trishume @dsp-ant 

Release Notes:

- Zed now allows the model to control indentation when performing inline
transformation. We're hoping this improves the indentation experience in
Python and other indentation-sensitive languages, but it does require
more from the model.

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
2024-08-12 22:41:24 -06:00
Marshall Bowers
b4c22cc861
collab: Add ability to revoke LLM service access tokens (#16143)
This PR adds the ability to revoke access tokens for the LLM service.

There is a new `revoked_access_tokens` table that contains the
identifiers (`jti`) of revoked access tokens.

To revoke an access token, insert a record into this table:

```sql
insert into revoked_access_tokens (jti) values ('1e887b9e-37f5-49e8-8feb-3274e5a86b67');
```

We now attach the `jti` as `authn.jti` to the tracing spans so that we
can associate an access token with a given request to the LLM service.

Release Notes:

- N/A
2024-08-12 21:47:05 -04:00
Piotr Osiewicz
0bc9fc9487
assistant: Slash command tweaks (#16140)
Release Notes:

- N/A
2024-08-13 02:34:03 +02:00
Max Brunsfeld
dbcd06642c
Track lifetime spending for each user and model (#16137)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-12 20:15:26 -04:00
Piotr Osiewicz
68ae347077
chore: Remove a bunch of unused structs (#16139)
Found by beta clippy.

Release Notes:

- N/A
2024-08-13 01:43:19 +02:00
Marshall Bowers
8a148f3a13
Add feature-flagged access to LLM service (#16136)
This PR adds feature-flagged access to the LLM service.

We've repurposed the `language-models` feature flag to be used for
providing access to Claude 3.5 Sonnet through the Zed provider.

The remaining RPC endpoints that were previously behind the
`language-models` feature flag are now behind a staff check.

We also put some Zed Pro related messaging behind a feature flag.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
2024-08-12 18:13:40 -04:00
Kirill Bulatov
3bebb8b401
Allow to cycle through center/top/bot scroll positions (#16134)
On top of `editor::ScrollCursorCenter`, `editor::ScrollCursorTop`,
`editor::ScrollCursorBottom` actions, adds an
`editor::ScrollCursorCenterTopBottom` one, that allows using a single
keybinding to scroll between positions on the screen.

The implementation matches a corresponding Emacs feature: there's a
timeout (1s) that is kept after every switch, to allow continuously
changing the positions, center (initial) -> top -> bottom
Scrolling behavior is the same as the existing actions (e.g. editor will
ignore scroll to bottom, if there's not enough space above).

After 1s, next position is reset to the initial, center, one.


Release Notes:

- Added an `editor::ScrollCursorCenterTopBottom` action for toggling
scroll position with a single keybinding

---------

Co-authored-by: Alex Kladov <aleksey.kladov@gmail.com>
2024-08-13 00:32:30 +03:00
Marshall Bowers
98516b5527
collab: Restrict usage of the LLM service to accounts older than 30 days (#16133)
This PR restricts usage of the LLM service to accounts older than 30
days.

We now store the GitHub user's `created_at` timestamp to check the
GitHub account age. If this is not set—which it won't be for existing
users—then we use the `created_at` timestamp in the Zed database.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
2024-08-12 17:27:21 -04:00
Kirill Bulatov
f398ecc3fb
Allow inserting text into the editor via the action (#16131)
Improves workflows, based on the keymaps that group actions behind a
certain symbol.
E.g.

```json5
", o k": "zed::OpenKeymap",
", o K": "zed::OpenDefaultKeymap",
// other `,`-based keymaps
```

Now, it's possible to do 
```json
", ,": ["editor::HandleInput", ","]
```

and type `,` without waiting for the timeout due to `,`-based bindings.

Release Notes:

- Add an `editor::HandleInput` action to ease typing symbols that are
part of keymaps. E.g. if `, o k` keybinding is bound, `", ,":
["editor::HandleInput", ","]` would allow to type `,` without timeouts.

---------

Co-authored-by: Alex Kladov <aleksey.kladov@gmail.com>
2024-08-13 00:02:52 +03:00
Max Brunsfeld
a3c79218c4
Report telemetry events for rate limit errors (#16130)
clickhouse telemetry schema:

```
CREATE TABLE default.llm_rate_limit_events
(
    `time` DateTime64(3),
    `user_id` Int32,
    `is_staff` Bool,
    `plan` LowCardinality(String),
    `model` String,
    `provider` LowCardinality(String),
    `usage_measure` LowCardinality(String),
    `requests_this_minute` UInt64,
    `tokens_this_minute` UInt64,
    `tokens_this_day` UInt64,
    `max_requests_per_minute` UInt64,
    `max_tokens_per_minute` UInt64,
    `max_tokens_per_day` UInt64,
    `users_in_recent_minutes` UInt64,
    `users_in_recent_days` UInt64
)
ORDER BY tuple()
```

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-12 16:31:11 -04:00
Max Brunsfeld
1674e12ccb
Expose anthropic API errors to the client (#16129)
Now, when an anthropic request is invalid or anthropic's API is down,
we'll expose that to the user instead of just returning a generic 500.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-12 13:11:48 -07:00
Marshall Bowers
f3ec8d425f
collab: Use a separate Anthropic API key for Zed staff (#16128)
This PR makes it so Zed staff can use a separate Anthropic API key for
the LLM service.

We also added an `is_staff` column to the `usages` table so that we can
exclude staff usage from the "active users" metrics that influence the
rate limits.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
2024-08-12 15:20:34 -04:00
Marshall Bowers
ebdde5994d
collab: Don't issue LLM API tokens if the user has not accepted the ToS (#16123)
This PR adds a check to the LLM API token issuance to ensure that we
only issue tokens to users that have accepted the terms of service.

Release Notes:

- N/A
2024-08-12 14:10:08 -04:00
Michael Angerman
63aef7f798
command_palette: Remove project as a dependency in Cargo.toml (#16082)
The *project crate* is only needed as a dev dependency in the command
palette..
So I am doing some code / dependency cleanup...

Release Notes:

- N/A
2024-08-12 13:01:32 -04:00
Marshall Bowers
ebdb755fef
Surface upstream rate limits from Anthropic (#16118)
This PR makes it so hitting upstream rate limits from Anthropic result
in an HTTP 429 response instead of an HTTP 500.

To do this we need to surface structured errors out of the `anthropic`
crate.

Release Notes:

- N/A
2024-08-12 11:59:24 -04:00
Thorsten Ball
fbb533b3e0
assistant: Require user to accept TOS for cloud provider (#16111)
This adds the requirement for users to accept the terms of service the
first time they send a message with the Cloud provider.

Once this is out and in a nightly, we need to add the check to the
server side too, to authenticate access to the models.

Demo:


https://github.com/user-attachments/assets/0edebf74-8120-4fa2-b801-bb76f04e8a17



Release Notes:

- N/A
2024-08-12 17:43:35 +02:00
Piotr Osiewicz
98f314ba21
assistant: Add debug inspector (#16105)
I went with inline approach directly within the panel.
First, enable workflow debugging in the hamburger menu (this works
retroactively as well):


![image](https://github.com/user-attachments/assets/d2ab8edf-bb7b-49a4-8f70-9a6fe94dc7dd)

This enables debug buttons in the header of each step:

![image](https://github.com/user-attachments/assets/3b5d479f-7473-4c41-a2e7-8c10bb71f0ff)
Enabling one pretty-prints the workflow step internals:

![image](https://github.com/user-attachments/assets/e651e826-1270-49ff-8bb6-046c07c006bf)


Release Notes:

- N/A
2024-08-12 17:05:54 +02:00
Piotr Osiewicz
b6b081596a
assistant: Show tooltips on workflow step buttons only when cursor is in step (#16108)
Release Notes:

- N/A
2024-08-12 16:53:11 +02:00
Nathan Sobo
fc64843dd5
Enhance HTTP API for extensions (#16067)
# HTTP Client Improvements for Extension API

This PR enhances the HTTP client functionality in the Zed extension API,
providing more control over requests and allowing for streaming
responses.

## Key Changes

1. Extended `HttpRequest` struct:
   - Added `method` field to specify HTTP method
   - Added `headers` field for custom headers
   - Added optional `body` field for request payload

2. Introduced `HttpMethod` enum for supported HTTP methods

3. Updated `HttpResponse` struct:
   - Added `headers` field to access response headers
- Changed `body` type from `String` to `Vec<u8>` for binary data support

4. Added streaming support:
   - New `fetch_stream` function to get a response stream
   - Introduced `HttpResponseStream` resource for chunked reading

5. Updated internal implementations to support these new features

6. Modified the Gleam extension to use the new API structure

## Motivation

These changes provide extension developers with more flexibility and
control over HTTP requests. The streaming support is particularly useful
for handling large responses efficiently or ideally streaming into the
UI.

## Testing

- [x] Updated existing tests
- [ ] Added new tests for streaming functionality

## Next Steps

- Consider adding more comprehensive examples in the documentation
- Evaluate performance impact of streaming for large responses

Please review and let me know if any adjustments are needed.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-12 10:36:49 -04:00
Marshall Bowers
f952126319
collab: Remove LLM completions over RPC (#16114)
This PR removes the LLM completion messages from the RPC protocol, as
these now go through the LLM service as of #16113.

Release Notes:

- N/A
2024-08-12 10:08:56 -04:00
Nate Butler
f992cfdc7f
Update provider logos (#16115)
- Updates provider logos for Anthropic, Google and Ollama
- Increases the size of icons in the model selector

Release Notes:

- N/A
2024-08-12 09:55:00 -04:00
Marshall Bowers
6389c613a2
Always stream completions through the LLM service (#16113)
This PR removes the `llm-service` feature flag and makes it so all
completions are done via the LLM service when using the Zed provider.

Release Notes:

- N/A
2024-08-12 09:33:24 -04:00
Son
bab4da78b7
Fix corner radius when doing rounded_full (#15663)
Release Notes:

- Fixed issue when doing `rounded_full`, it should render a pill-shape
rect instead of current eye-shape.

For example with this code
`div().h_4().w_16().bg(rgb(0xffffff)).rounded_full()`

Current:

<img width="144" alt="image"
src="https://github.com/user-attachments/assets/f8b20c7c-d91f-4c20-9f38-d435f59e72b7">

Fixed:

<img width="172" alt="image"
src="https://github.com/user-attachments/assets/ff8bbe26-2b31-4ef1-a2fb-25b458386ffb">
2024-08-12 15:24:32 +02:00
Antonio Scandurra
a15a9565ab
Accept finished inline transformations only if the user saves manually (#16112)
Closes https://github.com/zed-industries/zed/issues/16042

This commit modifies the behavior of inline transformations to only
accept finished transformations when the user manually saves the file.
Previously, transformations were automatically accepted on any save
event, including autosaves.

This was achieved by updating the `Pane` and `Workspace` structs to emit
a new `UserSavedItem` event when a manual save occurs, and modifying the
`InlineAssistant` to register and handle this new event (instead of
`editor::Saved`).

Release Notes:

- N/A
2024-08-12 15:16:55 +02:00
Antonio Scandurra
48f6193628
Improve workflow step pruning and symbol similarity matching (#16036)
This PR improves workflow step management and symbol matching. We've
optimized step pruning to remove any step that intersects an edit and
switched to normalized Levenshtein distance for more accurate symbol
matching.

Release Notes:

- N/A
2024-08-12 11:09:07 +02:00
Nathan Sobo
355aebd0e4
Introduce prompt override script and adjust names (#16094)
This PR introduces a new script for iterative development of prompt
overrides in Zed.

Just `script/prompts link` and your running Zed should start using
prompts from `zed/assets/prompts`. Use `script/prompts unlink` to undo.
You can also link with `script/prompts link --worktree` to store the
prompts to a `../zed_prompts` worktree that's a sibling of your repo, in
case you don't want to mess with your working copy. Just don't forget
about it!

Key changes:
- Add new `script/prompts` for managing prompt overrides
- Rename `prompt_templates_dir` to `prompt_overrides_dir` for clarity
- Update paths to use `~/.config/zed/prompt_overrides` instead of
`~/.config/zed/prompts/templates`
- Adjust `PromptBuilder` to use the new `prompt_overrides_dir` function

These changes simplify the process of customizing prompts and provide a
more intuitive naming convention for override-related functionality.

Release Notes:

- N/A
2024-08-11 17:21:17 -06:00
Marshall Bowers
3140d6ce8c
collab: Temporarily bypass LLM rate limiting for staff (#16089)
This PR makes it so staff members will be exempt from rate limiting by
the LLM service.

This is just a temporary measure until we can tweak the rate-limiting
heuristics.

Staff members are still subject to upstream LLM provider rate limits.

Release Notes:

- N/A
2024-08-11 14:41:49 -04:00
Nathan Sobo
6f104fecad
Copy extension_api Rust files to OUT_DIR when building extension to work around rust-analyzer limitation (#16064)
Copies rust files from extension_api/wit to the OUT_DIR to allow
including them from within the crate, which is supported by
rust-analyzer. This allows rust-analyzer to deal with the included
files. It doesn't currently support files outside the crate.

Release Notes:

- N/A
2024-08-10 18:19:11 -06:00
Kyle Kelley
550e139b61
repl: Set the default lines ✖️ columns for the REPL to 32x128 (#16061)
![image](https://github.com/user-attachments/assets/dce938ef-bdfd-4412-a074-90c883286263)

Release Notes:

- Improved visuals of repl stdout/stderr by reducing default line count
to 32
2024-08-10 10:28:56 -07:00
Max Brunsfeld
33e120d964
Capture telemetry data on per-user monthly LLM spending (#16050)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 16:38:37 -07:00
Max Brunsfeld
8688b2ad19
Add telemetry for LLM usage (#16049)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 18:15:57 -04:00
Max Brunsfeld
423c7b999a
Larger rate limit integers (#16047)
Tokens per day may exceed the range of Postgres's 32-bit `integer` data
type.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 14:07:49 -07:00
Marshall Bowers
0932818829
zed_extension_api: Release v0.0.7 (#16048)
This PR releases v0.0.7 of the Zed extension API.

Support for this version of the extension API will land in Zed v0.149.0.

Release Notes:

- N/A
2024-08-09 16:52:16 -04:00
Max Brunsfeld
fbebb73d7b
Use LLM service for tool call requests (#16046)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 16:22:58 -04:00
Max Brunsfeld
d96afde5bf
Avoid insert ... on conflict on startup (#16045)
These queries advance the id sequence even when there's nothing to
insert

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 15:32:11 -04:00
Max Brunsfeld
b1c69c2178
Fix usage recording in llm service (#16044)
Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-09 11:48:18 -07:00
Peter Tripp
eb3c4b0e46
Docs Party 2024 (#15876)
Co-authored-by: Raunak Raj <nkray21111983@gmail.com>
Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
Co-authored-by: Bennet <bennet@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
Co-authored-by: Joseph T Lyons <JosephTLyons@gmail.com>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Jason <jason@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Jason Mancuso <7891333+jvmncs@users.noreply.github.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
2024-08-09 13:37:54 -04:00
Bennet Bo Fenner
c633fa5a10
assistant: Improve quote selection (#16038)
https://github.com/user-attachments/assets/fe283eec-169f-4dfd-bae2-cc72c1c3f223



Release Notes:

- Include more context when using `assistant: Quote selection` to insert
text into the assistant panel

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-09 18:29:27 +02:00
Marshall Bowers
49f760eeda
collab: Set LLM_DATABASE_MAX_CONNECTIONS (#16035)
This PR updates the collab template to set the
`LLM_DATABASE_MAX_CONNECTIONS` environment variable for the LLM service.

Release Notes:

- N/A
2024-08-09 11:16:02 -04:00
Max Brunsfeld
225726ba4a
Remove code paths that skip LLM db in prod (#16008)
Release Notes:

- N/A
2024-08-09 10:41:50 -04:00
Thorsten Ball
c1872e9cb0
vim: Fix ctrl-u/ctrl-d with high vertical_scroll_margin (#16031)
This makes sure that the `vertical_scroll_margin` doesn't leave the
cursor out of screen or somewhere it shouldn't go when it's higher than
the visible lines on screen.

So we cap it to `visible_line_count / 2`, similar to nvim:


5aa1a9532c/src/nvim/window.c (L6560)

Fixes #15101

Release Notes:

- Fixed `ctrl-u`/`ctrl-d` in Vim mode not working correctly when
`vertical_scroll_margin` is set to a really high value.

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-09 16:00:05 +02:00
Thorsten Ball
09c9ed4765
vim: Fix panic due to overflow when scrolling (#16029)
When setting `"vertical_scroll_margin": 99` or other high values this
can lead to a panic that crashes Zed.

Release Notes:

- vim: Fixed a possible panic that could happen when using a very high
value for `vertical_scroll_margin` that exceeded the number of visible
lines on the screen.

Co-authored-by: Bennet <bennet@zed.dev>
2024-08-09 15:15:27 +02:00
Thorsten Ball
19d8422933
stories: Get OverflowScrollStory to scroll again (#15982)
This makes it at least scroll again, but it doesn't scroll down to the
last element yet. We haven't figured out why yet.


Release Notes:

- N/A

Co-authored-by: Bennet <bennet@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
2024-08-09 12:32:26 +02:00
Thorsten Ball
173f6e7c8f
assistant panel: Make configuration view scrollable (#16022)
We had to resort to this "hack" to get it to work, since nothing else we
tried (changing the `Pane`, changing the `ConfigurationView`, changing
the `AssistantPanel`, ...) worked.

Release Notes:

- N/A

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Bennet <bennet@zed.dev>
2024-08-09 12:21:22 +02:00
Massimo Mund
e783142528
Fix vertical_scroll_margin not being capped for large vertical_scroll_margin values (#15473)
When switching to function definitions in a new buffer the
`AutoscrollStrategy::Focused` being emitted to scroll to the found
location.
If a large value `vertical_scroll_margin` (e.g.: 99) is set, this leads
to an incorrectly calculated position and the new buffer opens in the
wrong place.

In `autoscroll_vertically()` there is a margin calculated to cap the
value of `vertical_scroll_margin` for certain AutoscrollStrategies. This
margin is being used in `AutoscrollStrategy::Fit` and
`AutoscrollStrategy::Newest` but was probably forgotten for
`AutoscrollStrategy::Focused`.

- Might fix [#15101](https://github.com/zed-industries/zed/issues/15101)

Release Notes:

- N/A
2024-08-09 09:35:57 +02:00
Santeri Salmijärvi
06833d7360
Support MSbuild row-column format in PathWithPosition (#15589)
This implements #15412. Row-column parsing is changed into a regex to
support more complex patterns like the MSBuild diagnostics. Terminal
`word_regex` is also relaxed to match those suffixes.

Release Notes:

- N/A
2024-08-09 09:21:56 +02:00
Robin Malfait
7a600411cf
Add injections for tagged template literals (#15984)
This PR adds syntax highlighting support for `css`, `html`, `js`,
`json`, `sql`, `ts`, `yaml` and `yml` in `javascript`, `typescript` and
`tsx` languages where the contents of tagged template literals are now
highlighted.

This does not actually enable language features (like LSP support), it
only does syntax highlighting.

Before this change:
<img width="561" alt="image"
src="https://github.com/user-attachments/assets/74bace1b-5ce1-4b17-8a97-035bba152d9c">


After this change:
<img width="607" alt="image"
src="https://github.com/user-attachments/assets/f227145b-3f4a-4c27-b14f-7143bb19b4cf">

/cc @mrnugget 

Release Notes:

- Added syntax highlighting for tagged template literals in
`javascript`, `typescript` and `tsx` languages for `css`, `html`, `js`,
`json`, `sql`, `ts`, `yaml` and `yml`.
([#15984](https://github.com/zed-industries/zed/issues/15984))
2024-08-09 09:16:48 +02:00
Max Brunsfeld
240b7c641c
Fix llm queries (#16006)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
2024-08-08 17:21:38 -07:00
Max Brunsfeld
06625bfe94
Apply rate limits in LLM service (#15997)
Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-08 15:46:33 -07:00
Marshall Bowers
2bc503771b
assistant: Show an error when /fetch returns no content (#16001)
This PR makes it so the `/fetch` slash command will display an error
when the URL does not have any textual content:

<img width="308" alt="Screenshot 2024-08-08 at 4 51 55 PM"
src="https://github.com/user-attachments/assets/bf4cbc18-c65b-48a2-aedd-26b50f47f018">

Release Notes:

- N/A
2024-08-08 17:07:42 -04:00
Marshall Bowers
abb6d40fbf
Put /docs behind a feature flag (#16000)
This PR puts the `/docs` slash command behind a feature flag.

Release Notes:

- N/A
2024-08-08 16:51:35 -04:00
Conrad Irwin
bd59af1df5
vim: Support ranges in command (#15985)
The most requested feature here is "search and replace in visual mode",
but as a happy side effect we can now support things like :2,12j to join
those lines, and much much more.



Release Notes:

- vim: Added support for range syntax in command
([#9428](https://github.com/zed-industries/zed/issues/9428)).
- vim: Prefill command with `:'<,'>` from visual mode
([#13535](https://github.com/zed-industries/zed/issues/13535)).
2024-08-08 21:47:27 +01:00
Marshall Bowers
a39f1f5133
Fix Windows build in CI (#15990)
This PR fixes the Windows build in CI, which was failing due to Clippy
warnings.

Release Notes:

- N/A
2024-08-08 12:55:26 -04:00
Marshall Bowers
fbc629df7d
assistant: Put /search behind a feature flag (#15987)
This PR puts the `/search` slash command behind a feature flag.

Release Notes:

- N/A
2024-08-08 12:33:59 -04:00
CharlesChen0823
a71bfd41cc
recent_project: Fix overflow sub (#15965)
close: #15783 

Release Notes:

- Fixed a potential panic that can occur when deleting entries from the
recent-projects menu
([#15783](https://github.com/zed-industries/zed/issues/15783))
2024-08-08 15:58:59 +02:00
Piotr Osiewicz
73fb8277fc
assistant: Polish /workflow and steps UI (#15936)
Fixes #15923
Release Notes:

- Assistant workflow steps can now be applied and reverted directly from
within the assistant panel.

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Antonio <antonio@zed.dev>
2024-08-08 15:46:33 +02:00
Bennet Bo Fenner
514b79e461
collab: Always use newest anthropic model version (#15978)
When Anthropic releases a new version of their models, Zed AI users
should always get access to the new version even when using an old
version of zed.

Co-Authored-By: Thorsten <thorsten@zed.dev>

Release Notes:

- N/A

Co-authored-by: Thorsten <thorsten@zed.dev>
2024-08-08 15:24:08 +02:00
Bennet Bo Fenner
793cd88792
keymap: Show error notification when keymap is invalid (#15977)
This adds an error notification that pops up when the user has an
invalid keymap, similar to what we added for settings in #15905.

Release Notes:

- Added a popup that is displayed when the keymap is invalid
2024-08-08 14:11:46 +02:00
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