📝 update custom commands docs
This commit is contained in:
parent
692ea27c29
commit
8ff3d58387
1 changed files with 9 additions and 2 deletions
|
|
@ -117,7 +117,7 @@ You can add custom slash commands by adding to the `customCommands` property in
|
|||
|
||||
- `name`: the name of the command, which will be invoked with `/name`
|
||||
- `description`: a short description of the command, which will appear in the dropdown
|
||||
- `prompt`: a set of instructions to the LLM, which will be shown in the prompt
|
||||
- `prompt`: a templated prompt to send to the LLM
|
||||
|
||||
Custom commands are great when you are frequently reusing a prompt. For example, if you've crafted a great prompt and frequently ask the LLM to check for mistakes in your code, you could add a command like this:
|
||||
|
||||
|
|
@ -125,10 +125,17 @@ Custom commands are great when you are frequently reusing a prompt. For example,
|
|||
customCommands=[{
|
||||
"name": "check",
|
||||
"description": "Check for mistakes in my code",
|
||||
"prompt": "Please read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:\n- Syntax errors\n- Logic errors\n- Security vulnerabilities\n- Performance issues\n- Anything else that looks wrong\n\nOnce you find an error, please explain it as clearly as possible, but without using extra words. For example, instead of saying 'I think there is a syntax error on line 5', you should say 'Syntax error on line 5'. Give your answer as one bullet point per mistake found."
|
||||
"prompt": "{{{ input }}}\n\nPlease read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant:\n- Syntax errors\n- Logic errors\n- Security vulnerabilities\n- Performance issues\n- Anything else that looks wrong\n\nOnce you find an error, please explain it as clearly as possible, but without using extra words. For example, instead of saying 'I think there is a syntax error on line 5', you should say 'Syntax error on line 5'. Give your answer as one bullet point per mistake found."
|
||||
}]
|
||||
```
|
||||
|
||||
#### Templating
|
||||
|
||||
The `prompt` property supports templating with Handlebars syntax. You can use the following variables:
|
||||
|
||||
- `input` (used in the example above): any additional input entered with the slash command. For example, if you type `/test only write one test`, `input` will be `only write one test`. This will also include highlighted code blocks.
|
||||
- File names: You can reference any file by providing an absolute path or a path relative to the current working directory.
|
||||
|
||||
### Custom Slash Commands
|
||||
|
||||
If you want to go a step further than writing custom commands with natural language, you can write a custom function that returns the response. This requires using `config.ts` instead of `config.json`.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue