monacopilot 0.18.7 → 0.18.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,8 +29,9 @@ npm install monacopilot
|
|
|
29
29
|
|
|
30
30
|
2. **Register the AI completion to your editor**
|
|
31
31
|
|
|
32
|
+
In your frontend code:
|
|
33
|
+
|
|
32
34
|
```javascript
|
|
33
|
-
// In your frontend code
|
|
34
35
|
import * as monaco from 'monaco-editor';
|
|
35
36
|
import {registerCompletion} from 'monacopilot';
|
|
36
37
|
|
|
@@ -47,12 +48,11 @@ registerCompletion(monaco, editor, {
|
|
|
47
48
|
|
|
48
49
|
3. **Create your completion API handler**
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// to handle completion requests from the editor
|
|
51
|
+
Create an API handler for the endpoint (e.g. /code-completion) you provided in the `registerCompletion` function to handle completion requests from the editor.
|
|
52
|
+
|
|
53
|
+
Example using Express.js:
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
```javascript
|
|
56
56
|
import {Copilot} from 'monacopilot';
|
|
57
57
|
|
|
58
58
|
const copilot = new Copilot(OPENAI_API_KEY, {
|
|
@@ -76,9 +76,10 @@ app.post('/code-completion', async (req, res) => {
|
|
|
76
76
|
});
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
**That's it! Your Monaco Editor now has AI-powered completions! 🎉**
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
> [!NOTE]
|
|
82
|
+
> You can use any backend framework or programming language for your API handler, as long as the endpoint is accessible from the browser. For non-JavaScript implementations, see [Cross-Language API Handler Implementation](#cross-language-api-handler-implementation).
|
|
82
83
|
|
|
83
84
|
### Examples
|
|
84
85
|
|