# AI prompt
## Preface
In AIEditor, `AI menu`, `AI command`, and `AI code block` can all be configured with custom prompt words. For example, the menu configuration is as follows
```ts
new LinwitDocEditor({
element: "#aiEditor",
ai:{
// models:{...]
menus:[
{
icon: ``,
name: "AI Continuation",
prompt: "Please help me expand on this passage.",
text: "focusBefore",
},
{
icon: ``,
name: "AI Optimization",
prompt: "Please help me optimize the content of this text and return the results",
text: "selected",
},
]
},
})
```
At this point, the user selects a text in the editor. Assume that the selected text is: "`AIEditor is a good editor`", and then clicks the `AI Optimization` menu.
Then, AIEditor will send the following content to the LLM:
```
AIEditor is a good editor
Please help me optimize the content of this text and return the results
```
And wait for the LLM to response the result, allowing the user to perform subsequent operations. At this point, if the text content selected by the user conflicts with `Please help me optimize the content of this text and return the results`
, or may have additional meanings, the content returned by the LLM may not necessarily be what we want.
## `{content}` placeholder
In order to solve the scenario where the text selected by the user may conflict with the simple prompt definition, AIEditor supports adding a custom placeholder `{content}` in the prompt content.
Suppose our custom prompt is:
```
Please help me optimize the text content and return the result. The text content is:
“{content}”
Note that only English content can be returned, not Chinese content.
```
Then, suppose the user selects the text content of the editor as: "`AIEditor is a good editor`", and then clicks the `AI Optimization` menu, the prompt AIEditor gives to the LLM as follows:
```
Please help me optimize the text content and return the result. The text content is:
“AIEditor is a good editor”
Note that only English content can be returned, not Chinese content.
```
The prompt becomes clearer and easier to use by using the `{content}` placeholder.