# Introduce an Assistant Panel \(\#2584\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d5441ba386245fd3cf27403dae63415e9108ca72)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d5441ba386245fd3cf27403dae63415e9108ca72

Requested commit: d5441ba386245fd3cf27403dae63415e9108ca72

Commit: d5441ba386245fd3cf27403dae63415e9108ca72

Tree: 042e104481b6539613a1df5c6b128477452107f9

Author: Antonio Scandurra

Committer: GitHub

## Message

```
Introduce an Assistant Panel (#2584)

This pull request introduces a new assistant panel to Zed that lets
users interact with OpenAI using their API key:

![CleanShot 2023-06-07 at 09 39
10@2x](https://github.com/zed-industries/zed/assets/482957/ba2a5830-9aeb-4c45-a182-a44d6a72675f)

After setting the key up, it will be saved to the keychain and
automatically loaded the next time the assistant panel is opened. The
key can be reset using `assistant: reset key`.

![CleanShot 2023-06-07 at 09 39
23@2x](https://github.com/zed-industries/zed/assets/482957/a6808bb0-0098-45ae-a2e3-f4d88472e626)

From there, users can type messages in a multi-buffer and hit
`cmd-enter` (`assistant: assist`) to stream assistant responses using
the OpenAI API. Responses can be canceled by hitting `escape`.

![CleanShot 2023-06-07 at 09 40
16@2x](https://github.com/zed-industries/zed/assets/482957/749779da-850e-4ad5-af04-74a3ca39f7ad)

Users can quote a selection from the active editor by hitting `cmd->`
(`assistant: quote selection`), which will embed the selected piece of
text in a Markdown fenced code block. Conversations with the assistant
are ephemeral at the moment, but can be easily copy/pasted:

![CleanShot 2023-06-07 at 09 50
33@2x](https://github.com/zed-industries/zed/assets/482957/b3386c10-4c51-4419-a0e0-517112ef6521)

Release Notes:

- Added a new assistant panel feature that enables interacting with
OpenAI using an API key. This replaces the previous experimental `ai:
assist` command that would work on any buffer. The experience is similar
to the one offered by ChatGPT with the added ability to edit, delete or
enhance previous messages. When hitting `cmd-enter`, the assistant will
start streaming responses from OpenAI. A response stream can be canceled
using `escape`. Moreover, the active editor's selection can be quoted in
the assistant panel using `cmd->`, which will automatically embed the
selected piece of text in a Markdown fenced code block.
```

## Parents

- [c93b6cc599a65a7a074388e5b7577e2cbaf6eaeb](https://git.cafe/gitcafe/zed/commit/c93b6cc599a65a7a074388e5b7577e2cbaf6eaeb?format=markdown)

- [d3e0d38bef3a6738c445c0178387234a31d407a7](https://git.cafe/gitcafe/zed/commit/d3e0d38bef3a6738c445c0178387234a31d407a7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d5441ba386245fd3cf27403dae63415e9108ca72?format=markdown)
