Add docs_preprocessor
crate to support Zed Docs (#16700)
This PR adds a mdbook preprocessor for supporting Zed's docs. This initial version adds the following custom commands: **Keybinding** `{#kb prefix::action_name}` (e.g. `{#kb zed::OpenSettings}`) Outputs a keybinding template like `<kbd class="keybinding">{macos_keybinding}|{linux_keybinding}</kbd>`. This template is processed on the client side through `mdbook` to show the correct keybinding for the user's platform. **Action** `{#action prefix::action_name}` (e.g. `{#action zed::OpenSettings}`) For now, simply outputs the action name in a readable manner. (e.g. zed::OpenSettings -> zed: open settings) In the future we'll add additional modes for this template, like create a standard way to render `{action} ({keybinding})`. ## Example Usage ``` To open the assistant panel, toggle the right dock by using the {#action workspace::ToggleRightDock} action in the command palette or by using the {#kb workspace::ToggleRightDock} shortcut. ``` Release Notes: - N/A
This commit is contained in:
parent
5ee4c036f9
commit
46bb04a019
16 changed files with 639 additions and 24 deletions
|
@ -2,7 +2,8 @@
|
|||
|
||||
The assistant panel provides you with a way to interact with large language models. The assistant is useful for various tasks, such as generating code, asking questions about existing code, and even writing plaintext, such as emails and documentation.
|
||||
|
||||
To open the assistant panel, toggle the right dock by using the `workspace: toggle right dock` action in the command palette or by using the <kbd>cmd-r|ctrl-alt-b</kbd> shortcut.
|
||||
To open the assistant panel, toggle the right dock by using the {#action workspace::ToggleRightDock} action in the command palette or by using the
|
||||
{#kb workspace::ToggleRightDock} shortcut.
|
||||
|
||||
> **Note**: A custom [key binding](../key-bindings.md) can be set to toggle the right dock.
|
||||
|
||||
|
@ -10,9 +11,9 @@ Once you have [configured a provider](./configuration.md#providers), you can int
|
|||
|
||||

|
||||
|
||||
To create a new context editor, press <kbd>cmd-n|ctrl-n</kbd> or use the menu in the top right of the assistant panel and select the `New Context` option.
|
||||
To create a new context editor, press {#kb workspace::NewFile} or use the menu in the top right of the assistant panel and select the `New Context` option.
|
||||
|
||||
In the context editor, select a model from one of the configured providers, type a message in the `You` block, and submit with <kbd>cmd-enter|ctrl-enter</kbd>.
|
||||
In the context editor, select a model from one of the configured providers, type a message in the `You` block, and submit with {#kb assistant::Assist}.
|
||||
|
||||
### Interacting with the Assistant
|
||||
|
||||
|
@ -30,11 +31,11 @@ To begin, select a model and type a message in a `You` block.
|
|||
|
||||
As you type, the remaining tokens count for the selected model is updated.
|
||||
|
||||
Inserting text from an editor is as simple as highlighting the text and running `assistant: quote selection` (<kbd>cmd+shift+>|ctrl+shift+></kbd>); Zed will wrap it in a fenced code block if it is code.
|
||||
Inserting text from an editor is as simple as highlighting the text and running `assistant: quote selection` ({#kb assistant::QuoteSelection}); Zed will wrap it in a fenced code block if it is code.
|
||||
|
||||

|
||||
|
||||
To submit a message, use <kbd>cmd-enter|ctrl-enter</kbd> (`assistant: assist`). Unlike typical chat applications where pressing <kbd>enter</kbd> would submit the message, in the assistant editor, our goal was to make it feel as close to a regular editor as possible. So, pressing <kbd>enter</kbd> simply inserts a new line.
|
||||
To submit a message, use {#kb assistant::Assist}(`assistant: assist`). Unlike typical chat applications where pressing <kbd>enter</kbd> would submit the message, in the assistant editor, our goal was to make it feel as close to a regular editor as possible. So, pressing {#kb editor::Newline} simply inserts a new line.
|
||||
|
||||
After submitting a message, the assistant's response will be streamed below, in an `Assistant` message block.
|
||||
|
||||
|
@ -53,12 +54,12 @@ Simple back-and-forth conversations work well with the assistant. However, there
|
|||
The assistant gives you the flexibility to have control over the context. You can freely edit any previous text, including the responses from the assistant. If you want to remove a message block entirely, simply place your cursor at the beginning of the block and use the `delete` key. A typical workflow might involve making edits and adjustments throughout the context to refine your inquiry or provide additional information. Here's an example:
|
||||
|
||||
1. Write text in a `You` block.
|
||||
2. Submit the message with <kbd>cmd-enter|ctrl-enter</kbd>.
|
||||
2. Submit the message with {#kb assistant::Assist}.
|
||||
3. Receive an `Assistant` response that doesn't meet your expectations.
|
||||
4. Cancel the response with <kbd>escape</kbd>.
|
||||
5. Erase the content of the `Assistant` message block and remove the block entirely.
|
||||
6. Add additional context to your original message.
|
||||
7. Submit the message with <kbd>cmd-enter|ctrl-enter</kbd>.
|
||||
7. Submit the message with {#kb assistant::Assist}.
|
||||
|
||||
Being able to edit previous messages gives you control over how tokens are used. You don't need to start up a new context to correct a mistake or to add additional information, and you don't have to waste tokens by submitting follow-up corrections.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue